简体   繁体   English

JAR文件不从ext加载类文件

[英]JAR file does not load class files from ext

I installed JDK 1.6 on my Linux system, the $JAVA _HOME directory is /usr/java/jdk1.6.0_07 . 我在我的Linux系统上安装了JDK 1.6,$ JAVA _HOME目录是/usr/java/jdk1.6.0_07 I built the path on Eclipse to $JAVA_HOME. 我在Eclipse上构建了$ JAVA_HOME的路径。 It runs smoothly through Eclipse and loads all third party JAR files from /usr/java/jdk1.6.0_07/jre/lib/ext/ , but when I export the JAR file and run it, it throws ClassNotFoundExecption . 它在Eclipse中顺利运行并从/usr/java/jdk1.6.0_07/jre/lib/ext/加载所有第三方JAR文件,但是当我导出JAR文件并运行它时,它会抛出ClassNotFoundExecption

Why? 为什么?

  1. Did you install Java properly? 你安装了Java吗? Here are some instruction for installing Java 7 or Java 6 以下是安装Java 7Java 6的一些说明
  2. Are you sure that the version of Java you are using is correct one since there can be several versions of java on linux? 你确定你使用的Java版本是正确的,因为在Linux上可以有几个版本的Java吗? Try java -version on terminal where you run it to check. 在运行它的终端上尝试使用java -version进行检查。
  3. Do you use any third party library? 你使用任何第三方图书馆吗? If so, did you specify the class path when you run the jar file or bundle them inside your jar file? 如果是这样,您在运行jar文件时是否指定了类路径,或者将它们捆绑在jar文件中?

What does java -version return? java -version返回什么? Are you using the same JRE for execution? 您是否使用相同的JRE执行?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM