安装jdk以后,在cmd中运行java,javac都可以,然后建立如下的路径文件夹E:\javawork\lesson1,在此路径下建立记事本,代码如下:
public class hello
{
public static void main(String [] args)
{
}
}
运行javac能编译生成hello.class,可是就是不能用java命令运行,总是提示"exception in thread "main"java.lang. Noclassdeffounderror:E:\javawork\lesson1\hello",我已经设置了classpath为E:\javawork\lesson1,为什么还是错误呢???(path路径也没有错误)
public class hello
{
public static void main(String [] args)
{
}
}
运行javac能编译生成hello.class,可是就是不能用java命令运行,总是提示"exception in thread "main"java.lang. Noclassdeffounderror:E:\javawork\lesson1\hello",我已经设置了classpath为E:\javawork\lesson1,为什么还是错误呢???(path路径也没有错误)
public class hello
{
public static void main(String [] args)
{
System.out.println("hello world");
}
}
提示:"exception in thread "main"java.lang. Noclassdeffounderror:E:\javawork\lesson1\hello"运行javac也能编译过去的,可就不能运行!
我已经实验过n中方法了,实在是无能为力了,帮帮忙吧!!
那个classpath应该怎么设置呀,我按照网上说的设置了,可还是不行呀!
java d:\ 全路径
第二个。。你的文件名后缀是否被隐藏。。你建立的txt文本,可能还带有txt的后缀。。cmd set classpath=E:\javawork\lesson1 注意=号两边不能有空格。
你再试下。。我就不信运行不了 你不要看网上怎么配的,要知道为什么这样配