类在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)
使用到了一个外部的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)
解决方案 »
- 请问构造方法不可以被调用吗?
- 大家帮我推荐一本关于JAVA框架设计的书
- 求助,关于某种技术入门指导
- 急,jspsmart出错,各位帮帮忙啊,在线等
- 如何用java在数据库中删除一行数据?
- 关于“嵌套interface”的疑问,java 菜鸟,望大侠赐教!!
- jreport问题????
- Linux下如何用系统默认的浏览器打开网页?
- 请问我如何用java打开一个word文档,就像双击文档一样,系统调出word!
- 有关RunTime的问题,发言有分
- 斑竹帮我看看,这个问题扰我一个星期了
- 我安装了jdk-1_5_0_04-nb-4_1-win.exe ,为何在 安装的bin 目录下找不以javac.exe 呢?
ICE.jar放在jre\lib\ext这个目录
也放到了C:\Java\jdk1.5.0_06\lib下面
没用,还是一样的错误
源代码本身写的有问题,所以class文件也有问题,怎么放jar文件都不行了
Exception in thread "main" java.lang.NoClassDefFoundError: helloworld
一定是保存的文件名为HelloWorld,类名为helloworld,呵呵,如果是的话,那问题是有点低级,我以前也常犯
这个是错误的。应该是这样:
java demo.ice.helloworld.server.HelloServer
多谢各位
终于发现真正的原因了
我在设置里面
classpath写成class_path
大晕