jdk 不能运行

来源:百度知道 编辑:UC知道 时间:2024/05/27 08:07:28
我安装了jdk1.6.0。环境变量,classpath都按照提供的方法设置好了,可是在运行的时候能编译,且生成了.class文件,但却不能执行。执行的时候提示说:could not find the main class

我只是用一个helloworld程序做试验啊!
public class helloworld
{
public static void main(String args[])
{
System.out.println("Hello,World!");
}
}
请教高手!!!!

应该是classpath设置问题,classpath是有顺序的,如果在前面找到相应的目录,后面的目录就不访问了。最好在设置classpath的时候把当前目录放在最前面,调试的时候,在当前目录就行了set classpath=.;%classpath%

程序没问题,还是路径设置问题。

我有时候也会出现这样的情况,你得把路径放在系统变量的PATH里,我记得我有一次好像是这样的,实在不得你在CMD里,运行一下set path命令,看一下PATH
总之,这个问题多半是环境变量出了问题了