Re: java game for mac
On Feb 10, 2:40 pm, bob <b...@coolgroups.com> wrote:
I made a java [sic] slot machine game for mac, but i [sic] don't know how=
distribute it or package it.
Do I need to create a batch file or shell script that says something
java -classpath .:jogl.jar SlotMachine
If I just run the class, it gives me an error.
You need to study classpaths generally. All libraries on which the
program depends must be available.
The proper way to distribute applications is in a JAR file, putting it
in turn in a ZIP file along with its dependencies (such as the
"jogl.jar" dependency that you show). You then unpack the ZIP into
the target machine at a deployment directory of your choice (e.g.,
"deploymentDir/", perhaps under your home directory).
Read the online docs about the "jar" command:
Also, the tutorials get into some depth about deployment and JARs:
Put the dependency JARs in the same directory as the application JAR,
or in a subdirectory thereof.
Set up the dependencies (jogl.jar) in the "Class-Path:" section of the
Then you can use your OS to associate the JAR with the "java -jar"
command, much as you associate ".odt" with OpenOffice.
You can also create a shell file to run "java -jar slotgame.jar".
Bear in mind that with the "-jar" option, the "java" command ignores
the CLASSPATH envar and the "-classpath" ("-cp") options.
Study the links!