Landon
Landon

Reputation: 4108

packaging java jar library with my application

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.

Upvotes: 0

Views: 671

Answers (1)

Zds
Zds

Reputation: 4359

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:

Manifest-Version: 1.0
Main-Class: fi.ropecon.contv.client.ConTVClient
Created-By: "Jari Juslin <[email protected]>"
Class-Path: lib/j2ee.jar lib/jbossall-client.jar lib/log4j.jar lib/jnp-client.jar

"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.

Upvotes: 1

Related Questions