用的Myeclipse 8.5拖拽做的。其中导入了一些jar文件。但是打包后,运行是能运行,但一些功能都没了。看了一下,原来打成的jar文件中引用的lib中的jar没有打进去啊怎么弄啊??
我直接将lib放到压缩包src目录下,(和之前在MyEclipse中的目录一样)也是不能正常运行。怎么弄啊??用的MyEclipse带的那种打包-》Export-》Jar file->我的整个项目所有的都选上了,lib目录也选上了。 …………next->next->选Main class->完成但是打出来的却没有lib目录…………是不是这样打??我打包打错了??
里面没有引用其他jar文件的很正常,一引用其他的jar文件打包就不行了。在MyEclipse里运行正常
我直接将lib放到压缩包src目录下,(和之前在MyEclipse中的目录一样)也是不能正常运行。怎么弄啊??用的MyEclipse带的那种打包-》Export-》Jar file->我的整个项目所有的都选上了,lib目录也选上了。 …………next->next->选Main class->完成但是打出来的却没有lib目录…………是不是这样打??我打包打错了??
里面没有引用其他jar文件的很正常,一引用其他的jar文件打包就不行了。在MyEclipse里运行正常
引用的jar文件可不能打进入
修改a.jar的META-INF/MAINFEST.MF文件
把引用的jar相对路径添加进入,这样才能调用
我的是放在src/lib/***.jar,
META-INF/MAINFEST.MF文件添加路径要怎样添加啊举一个例子吧,谢谢了
【推荐参考文档】[1] JAR MANIFEST, http://download.oracle.com/javase/6/docs/technotes/guides/jar/jar.html#JAR%20Manifest
[2] Java Tutorials, Adding Classes to the JAR File's Classpath, http://download.oracle.com/javase/tutorial/deployment/jar/downman.html
[3] Java Tutorials, Installed Extensions, http://download.oracle.com/javase/tutorial/ext/basics/install.html
不过,最好你自己练练jar命令, 手动打几次就清楚了.
---
Note: The Class-Path header points to classes or JAR files on the local network, not JAR files within the JAR file or classes accessible over internet protocols. To load classes in JAR files within a JAR file into the class path, you must write custom code to load those classes. For example, if MyJar.jar contains another JAR file called MyUtils.jar, you cannot use the Class-Path header in MyJar.jar's manifest to load classes in MyUtils.jar into the class path.eclipse 3.6
Rsrc-Main-Class: com.linzuxiong.thinkinginjava.Joining
Main-Class: org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader