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
请各位高手指点下.谢谢了

解决方案 »

  1.   

    我运行了其他的程序包括helloworld可是都是一样的问题啊
      

  2.   

    class JavaThrow
    {
      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); 
    }
    }
    }
    这个是源程序啊
      

  3.   

    对呀,我也是呀,编了一个程序,关于接口的(本社区有),用jdk+记事本运行结果都正确,用JCreator,就出现这种情况,也不知道为什么。
      

  4.   

    刚在jcreator调试了下,没问题,请问你是怎样编译的?create new exception
    java.lang.ArithmeticException: 创建新的异常
    java.lang.ArrayIndexOutOfBoundsException
    java.lang.StringIndexOutOfBoundsException
      

  5.   

    就是先
     javac JavaThrow.java
     java  JavaThrow
    然后再运行就是运行不出来啊
      

  6.   

    你javac JavaThrow.java成功了没?
    我刚才把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
      

  7.   

    path和 class有什么区别没有呢
    我设置了path的
      

  8.   

    javac JavaThrow.java这个成功了的
      

  9.   

    而且我的是java1.4.2也可以像你那样设置环境变量吗
      

  10.   

    是的。classpath,path的区别,本区的贴
    http://community.csdn.net/Expert/topic/4446/4446469.xml?temp=.4076044
      

  11.   

    谢谢你.我加了classpath以后运行就很正常了
    但是我可以问下你
    CLASSPATH=C:\JDK1.5\JRE\LIB\RT.JAR;C:\JDK1.5\LIB\TOOLS.JAR这一句语句是什么意思呢>
      

  12.   

    设置一个名叫CLASSPATHR的环境变量,设置JVM环境吧,具体是不是这样的意思我也不是也很清楚,只是知道大家都这样设置。