用我的应用程序打包 java jar 库
我在eclipse中开发了一个需要java3d的应用程序。我有 java3d 的 jar,但我不确定如何将它们放入最终的 jar 中,以便我的应用程序可以引用所需的类。我在 Mac 上,只是用命令行制作 jar,这是我的脚本:
cd /Users/landonsilla/Sites/3dviewer/bin
jar -cvf CyarkCloudViewerPro.jar pointCloudTest/*.class pointCloudTest/icons/*.png
它非常简单,它只需要一些类文件和一些图像,然后将它们放入 jar 中。如何将 java3d jar 放在那里?
最终目标是通过 jnlp 在我的网站上提供此内容。我的应用程序工作正常,并且我实现的 jnlp 传递机制工作正常。然而,我的应用程序在尝试执行 java3d 操作时崩溃了。
这似乎是一个简单而常见的请求,我只是无法找出答案。
I have developed an application in eclipse that requires java3d. I have the jars for java3d, but I'm not sure how to put them into my final jar such that my application can reference the required classes. I'm on a mac and just making the jars with the command line, this is my script:
cd /Users/landonsilla/Sites/3dviewer/bin
jar -cvf CyarkCloudViewerPro.jar pointCloudTest/*.class pointCloudTest/icons/*.png
It's pretty simple, it just takes some class files and some images and puts them in the jar. How do I put the java3d jars in there?
The end goal is to deliver this on my website via jnlp. My application works, and the jnlp deliver mechanism I implemented works fine. However, my app crashes when trying to do java3d stuff.
This seems like a simple and common request, I just can't figure out the answer.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您只需将 jar 文件添加到主 jar 中,然后在 MANIFEST.MF 文件中声明这些库。 MANIFEST.MF 示例:
“Main-Class”是当您使用 java -jar 命令启动程序时调用的启动程序的类。类路径是正常的 Java 类路径,但相对于主 jar 存档的根目录。
You just add the jar files into the main jar, and then announce the libraries on your MANIFEST.MF file. Example of the MANIFEST.MF:
"Main-Class" is the class that's called to start the program when you start program with java -jar command. Class-path is, well, normal Java classpath, but relative to the root of the main jar archive.