当前位置:编程学习 > JAVA >>

启动eclipse是报 no java virtual machine was found after searching the following location

这是一个JDK没有配置好的问题。解决办法如下:
 
运行CMD。

在里面输入java -version看有没有版本的提示?有的话说明你的JDK是对的,那么就是Eclipse的问题了。没有参考其他方法。

1)如果没有的话:

依次点击:“我的电脑”-(右键)“属性”-“高级”-“环境变量”,弹出Windows的“环境变量”配置卡。
在“系统变量”栏下执行三项操作:
①新建“Java_Home”,值:JDK所在的绝对路径(例如 D:\Program Files\Java\jdk1.5.0_04\)。
②新建“Classpath”(如果已有,则直接编辑),值: .;%Java_Home%\lib (若值中原来有内容,用分号与之隔开)。
③新建“Path”(如果已有,则直接编辑),值: %Java_Home%\bin; (若值中原来有内容,用分号与之隔开)。
或者
CLASSPATH
C:\Program Files\Java\jdk1.6.0_03\lib;E:\workbench\lib\javax.servlet.jar;

JAVA_HOME
C:\Program Files\Java\jdk1.6.0_03

Path
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Microsoft SQL Server\90\Tools\binn\;%JAVA_HOME%\bin;
参考资料:http://blog.csdn.net/lqz1988/archive/2010/12/29/6105324.aspx
 
测试:
 
[java] 
/*************************************************************************
 *  Compilation:  javac HelloWorld.java
 *  Execution:    java HelloWorld
 *
 *  Prints "Hello, World". By tradition, this is everyone's first program.
 *
 *  % java HelloWorld
 *  Hello, World
 *
 *  These 17 lines of text are comments. They are not part of the program;
 *  they serve to remind us about its properties. The first two lines tell
 *  us what to type to compile and test the program. The next line describes
 *  the purpose of the program. The next few lines give a sample execution
 *  of the program and the resulting output. We will always include such 
 *  lines in our programs and encourage you to do the same.
 *
 *************************************************************************/ 
 
public class helloworld { 
 
    public static void main(String[] args) { 
        System.out.println("Hello, World"); 
    } 
 

运行:
 
 
 
 
 

补充:综合编程 , 其他综合 ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,