类在D:\IceDemo\bin下面,完整目录是D:\IceDemo\bin\demo\ice\helloworld\server\HelloWorld.class 
使用到了一个外部的ICE.jar,放在D:\IceDemo\lib\目录下
我在D:\IceDemo\bin目录下执行 
java demo.ice.helloworld.server.HelloServer 
然后报错: 
Exception in thread "main" java.lang.NoClassDefFoundError: Ice/LocalException 
然后修改了classpath 
@echo off 
set classpath=%classpath%;D:\IceDemo\bin;D:\IceDemo\bin;D:\IceDemo\bin\demo\ice\helloworld\server\HelloWorld.class 
echo classpath: %classpath% 
java HelloWorld 当前的classpath为: .;D:\IceDemo\bin;D:\IceDemo\bin\demo\ice\helloworld\server\HelloServer.class;D:\IceDemo\bin\Ice.jar报错如下: 
D:\IceDemo\bin\demo\ice\helloworld\server>java HelloWorld 
Exception in thread "main" java.lang.NoClassDefFoundError: helloworld (wrong na
me: demo/ice/helloworld/server/helloworld)
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(Unknown Source)
        at java.security.SecureClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.access$100(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClassInternal(Unknown Source)

解决方案 »

  1.   

    把你的ICE.jar放在jre\lib\ext这个目录下
      

  2.   

    我的Java_home设置是 C:\Java\jdk1.5.0_06
    ICE.jar放在jre\lib\ext这个目录
    也放到了C:\Java\jdk1.5.0_06\lib下面
    没用,还是一样的错误
      

  3.   

    你的java文件的问题,把你的源代码中引入jar文件的部分贴出来
    源代码本身写的有问题,所以class文件也有问题,怎么放jar文件都不行了
      

  4.   

    但是我在eclipse的IDE环境中是可以正常运行的
      

  5.   

    D:\IceDemo\bin\demo\ice\helloworld\server>java HelloWorld 
    Exception in thread "main" java.lang.NoClassDefFoundError: helloworld 
    一定是保存的文件名为HelloWorld,类名为helloworld,呵呵,如果是的话,那问题是有点低级,我以前也常犯
      

  6.   

    set classpath=.;D:\IceDemo\lib\ICE.jar;D:\IceDemo\bin;%classpath%java demo.ice.helloworld.server.HelloServer
      

  7.   

    D:\IceDemo\bin\demo\ice\helloworld\server>java HelloWorld   
    这个是错误的。应该是这样:
    java demo.ice.helloworld.server.HelloServer
      

  8.   

    sgg512的法子对了
    多谢各位
      

  9.   

    晕倒
    终于发现真正的原因了
    我在设置里面
    classpath写成class_path
    大晕