Exception in thread "main" java.lang.NoClassDefFoundError: JavaThrow请问下出现这种情况可能有些什么样的原因呢。我的java运行环境是装了的。而且javac也能显示出来啊。那怎么还是每个java程序都出现这个呢?
出现了下面这个就代表我的javac没问题啊
F:\例题一>javac
Usage: javac <options> <source files>
where possible options include:
-g Generate all debugging info
-g:none Generate no debugging info
-g:{lines,vars,source} Generate only some debugging info
-nowarn Generate no warnings
-verbose Output messages about what the compiler is doing
-deprecation Output source locations where deprecated APIs are us
ed
-classpath <path> Specify where to find user class files
-sourcepath <path> Specify where to find input source files
-bootclasspath <path> Override location of bootstrap class files
-extdirs <dirs> Override location of installed extensions
-d <directory> Specify where to place generated class files
-encoding <encoding> Specify character encoding used by source files
-source <release> Provide source compatibility with specified release
-target <release> Generate class files for specific VM version
-help Print a synopsis of standard options
请各位高手指点下.谢谢了
出现了下面这个就代表我的javac没问题啊
F:\例题一>javac
Usage: javac <options> <source files>
where possible options include:
-g Generate all debugging info
-g:none Generate no debugging info
-g:{lines,vars,source} Generate only some debugging info
-nowarn Generate no warnings
-verbose Output messages about what the compiler is doing
-deprecation Output source locations where deprecated APIs are us
ed
-classpath <path> Specify where to find user class files
-sourcepath <path> Specify where to find input source files
-bootclasspath <path> Override location of bootstrap class files
-extdirs <dirs> Override location of installed extensions
-d <directory> Specify where to place generated class files
-encoding <encoding> Specify character encoding used by source files
-source <release> Provide source compatibility with specified release
-target <release> Generate class files for specific VM version
-help Print a synopsis of standard options
请各位高手指点下.谢谢了
{
public static void main(String args[])
{
try{
throw new ArithmeticException("创建新的异常");
}
catch(ArithmeticException ae)
{
System.out.println("create new exception"); System.out.println(ae);
}
try{
throw new ArrayIndexOutOfBoundsException();
}
catch(ArrayIndexOutOfBoundsException ai)
{
System.out.println(ai);
}try {
throw new StringIndexOutOfBoundsException();
}
catch(StringIndexOutOfBoundsException si)
{
System.out.println(si);
}
}
}
这个是源程序啊
java.lang.ArithmeticException: 创建新的异常
java.lang.ArrayIndexOutOfBoundsException
java.lang.StringIndexOutOfBoundsException
javac JavaThrow.java
java JavaThrow
然后再运行就是运行不出来啊
我刚才把JavaThrow.java复制到C:\
执行了下。也一切正常。
我的JDK是1.5
环境变量CLASSPATH=C:\JDK1.5\JRE\LIB\RT.JAR;C:\JDK1.5\LIB\TOOLS.JAR;.(最后有个点)
你设置下环境变量CLASSPATH看如何。
C:\>javac JavaThrow.javaC:\>java JavaThrow
create new exception
java.lang.ArithmeticException: 创建新的异常
java.lang.ArrayIndexOutOfBoundsException
java.lang.StringIndexOutOfBoundsException
我设置了path的
http://community.csdn.net/Expert/topic/4446/4446469.xml?temp=.4076044
但是我可以问下你
CLASSPATH=C:\JDK1.5\JRE\LIB\RT.JAR;C:\JDK1.5\LIB\TOOLS.JAR这一句语句是什么意思呢>