Moving Xith3d around.

im trying to create a redistributable game using xith3d. now the contraint im working under is that the user wont have to put jar files deep inside the directory structure as the installing of xith3d requires. im wondering, is it possible to put all the jar files that i need in one directory, and just manipulate the class path to get everything running???

Ive been trying to do this for a while using HelloXith3D.java. i have it compiling ok, but running it is a whole different story.

so in my c:\temp\ i have the following files:

hial.jar
jogl-natives-win32.jar
jogl.jar
junit.zip
log4j.zip
vecmath.jar
vorbis.zip
xith-demos.jar
xith-tk.jar
xith3d.jar
HelloXith3D.java
HelloXith3D.class

i was hoping the have the same structure on a another persons computer, and have them run the game just by using a java command.

is this at all possible?

Yep, that should be fine, though if you’re running from the command line you’re going to need to extract the DLLs (or .so) from the jar file I think.

Kev

Im still kinda new to java (im a C guy), so bear with me.

here is what i used to compile:

javac -classpath xith3d.jar;vecmath.jar;jogl.jar HelloXith3D.java

what would the java command be to run it??? ive tried all the combinations i can think of, and it either does nothing or errors.

90% of novice Java programmer problems are classpath problems.

At some point, you will want to explore Ant and Java Web Start. Ant lets you write a build script which includes your classpath. Java Web Start deploys your Java application including libraries.

well i got it working. i didnt know i had to make a directory structure of org/xith3d/gsg/. is there any way around this? i dont want my files all in that directory structure.

here is the command i ended up using:

java -cp xith3d.jar;vecmath.jar;jogl.jar;. org.xith3d.gsg.HelloXith3D

Java organizes it’s code in packages. There must be a corresponding directory for each package element, so there is no way around this directory structure. To avoid distributing the directory-structure, you could use the jar-utility to create a jar named “helloxith3d.jar” of all generated .class-Files (see the tool-documentation included in your J2SDK) and call your programm like:

java -cp xith3d.jar;vecmath.jar;jogl.jar;helloxith3d.jar org.xith3d.gsg.HelloXith3D

There is even a way to specify all information in a so called manifest-file, that has to be included in the jar archive, so you can call the program like

java -jar helloxith3d.jar

or use a double-click on the jar to run it under Windows.

The best way to do it, is to create a jnlp-File for Java WebStart, because by using WebStart you get an web based installer/updater (including desktop icons, etc.) for free! Since you can specify library dependencies in WebStart, you free yourself of maintaining the xith3d jars, they are simply installed/updated from the original location of the library-jnlp, when you start your program.

I don’t think that will work with native libraries unless they are pre-installed.

Using JWS is probably the simplest method, especially for multi-platform distribution in the short term. Once you get your head around how the classpath and native libraries work, then try other ways. Most of the JWS work has already been done for you. Perhaps I should upload my most recent JNLP as an example (got not time now, maybe this weekend) - the other examples should still work but may not have new things like hial.

Will.

It works at least under windows, if the dlls are in the same directory as the main jar.