问题描述:

I can't run tomcat server from eclipse but tomcat work good if I run it using command line.

Here is the Error that appears in console:

Error: Could not find or load main class C:\Program Files\Java\jdk1.7.0_21.

What should I do to resolve the problem ?

网友答案:

I get this error when my JAVA_HOME environment variable doesn't match the java I'm running (typically found in my path), or Java wasn't installed correctly and the default classpath doesn't include java itself.

But mostly I think you have a path with a space in it, and Eclipse (and, to be fair, most java programs) doesn't work correctly with these paths. Move your Tomcat to a location without a space in the path and you should be able to run.

网友答案:

Please check the JVM path in eclipse.ini. It should be on the second line in the path (next line to '-vm'). Default value is from environment variable.

If you have multiple JVM in your machine, to have Eclipse point to the one of your choice, you can do it in this ini file. For example:

-vm C:/Program Files/Java/jdk1.7.0_45/bin/javaw.exe

Hope this helps

相关阅读:
Top