问题描述
- java netty NoClassDefFoundError 找不到eventloop class
-
在eclipse上用用netty框架写了个demo,直接在eclipse上能编译运行成功,导出了个jar包, 用java -jar 运行后,报出了如下错误:Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: io/netty/channel/Even
tLoopGroup
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.privateGetMethodRecursive(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at sun.launcher.LauncherHelper.validateMainClass(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: io.netty.channel.EventLoopGroup
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)
... 7 more最开始以为是包没打好, 又重新在manifest里面定义了一下classpath,完事一样还是找不到eventloopgroup class,我工程里面就引用了一个netty-5.0.0.Alpha2,我看了一下这个包,class文件好好的静静的就躺在那里........为什么它找不到,求大神们给个解决方案。。。。
解决方案
检查下classpath环境变量的配置
解决方案二:
看下编译后的工程是否那个jar包!