This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Mac OS and the fly likes Java on Macs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » Mac OS
Bookmark "Java on Macs" Watch "Java on Macs" New topic

Java on Macs

Christopher Arthur
Ranch Hand

Joined: Mar 09, 2004
Posts: 149
I've been developing java on Windows, but I want to distribute my program so that Mac users can run it. On Windows, I've been making a .BAT file with the java command like:

java -classpath $CLASSPATH$;myjar.jar;myjar2.jar myPackage.myClass

Actually I would love also to know a more sophisticated way to launch a java program, like being able to click on an icon that doesn't look like a cog in a window, but that's another matter. I'm more concerned about how I would run my program on a Mac. Any suggestions?

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63869

You could create a shell script similar to your bat file. That would work on any UNIX platform including OS X.

There are ways to create Mac-specific clickable icons (I think I remeber a program named Platypus or something like that that helps create the application package).

[Asking smart questions] [About Bear] [Books by Bear]
Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023
Moving this to the Mac OS forum...

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Warren Dew
Ranch Hand

Joined: Mar 04, 2004
Posts: 1332
If you put your program into a single .jar file and put a manifest in it that says where the main() program is located, the jar file will start with a double click on Mac OS 10.2.8. It might not work on older versions of the operating system, though.
subject: Java on Macs
It's not a secret anymore!