[英]Packing jar file into exists jar file
I'm writing a MP3 player in Java. 我正在用Java编写MP3播放器。 If i will finish I want to pack all
.class
files in one .jar
file. 如果我要完成,我想将所有
.class
文件打包到一个.jar
文件中。 I don't want have player, which starts by console. 我不要播放器,该播放器由控制台启动。 If i open this one .jar file i want see player window.
如果我打开这个.jar文件,我想查看播放器窗口。
I know how to pack it. 我知道如何打包。 I must use
jar.exe
packer with params: cvfm Player.jar MANIFEST.MF ./config/*.class
and create MANIEST.MF
which content class that has main method. 我必须使用带有参数的
jar.exe
包装器: cvfm Player.jar MANIFEST.MF ./config/*.class
并创建MANIEST.MF
内容类具有main方法。
But the problem is when I want use another Look and Feel, or use existing .jar file. 但是问题是当我想使用其他外观或使用现有的.jar文件时。 I can put this existing
.jar
file into my player main dir and compile javac.exe
with parameter -cp .;./JarFile.jar
, but when I pack all compiled .class
files and my existsing JTattooDebug.jar
file into one Player.jar
file i don't see new Look and Feel i just see default view. 我可以将此现有的
.jar
文件放入播放器主目录,并使用-cp .;./JarFile.jar
参数编译javac.exe
,但是当我将所有已编译的.class
文件和我JTattooDebug.jar
文件JTattooDebug.jar
到一个Player.jar
文件,我看不到新的外观,我只是看到默认视图。
If you are using eclipse. 如果您使用的是日食。
Right-Click your project 右键单击您的项目
Export -> Runnable Jar File
Then select the destination for your jar, and make sure you have "Extract required libraries into generated JAR" selected. 然后选择jar的目标位置,并确保已选择“将所需的库提取到生成的JAR中”。 That will give you a runnable jar, complete with auto generated manifest, with all of your needed jars inside.
这将为您提供一个可运行的jar,其中包含自动生成的清单以及所有需要的jar。
Solved! 解决了! I had to add line:
我必须添加行:
Class-Path: lib/JTattooDebug.jar
in my MANIFEST.MF
file, now all works. 在我的
MANIFEST.MF
文件中,现在一切正常。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.