| Author |
What do I need to know about Java and OS X?
|
Emilio Gagliardi
Greenhorn
Joined: Jun 02, 2004
Posts: 16
|
|
Hi there, I've been searching all day trying to understand how Java works on Mac and I'm getting lost. I've located the directories that everything is supposed to happen in System/library/frameworks/javavm.framework but after that I'm stumped about what everything is and what to modify. The first thing I need to do is install JDK 1.5 beta. But Mac won't let me create a folder under Versions? Also, there wasn't any download at Sun for a "mac" version so I Downloaded the unix version, except the unix version is .bin file.
JAVAHOME Some applications look for Java�s home directory (JAVA_HOME) on the users system, especially during installation. If you need to explicitly set this, in a shell script or an installer, set it to /Library/Java/Home. Setting it to the target of that symbolic link can result in a broken application for your customers. Programatically you can use System.getProperty("java.home"), as you would expect. /Library/Java/Home also contains the /bin subdirectory where symbolic links to command-line tools like java and javac can be found. These tools are also accessible through /usr/bin.
Hoe does this relate to running Java programs from the command line? That I should put my .java files in Java/Home and all other archive files in Extensions? Good grief. And I thought Macs were user friendly... Cheers,
|
Emilio
|
 |
Dirk Schreckmann
Sheriff
Joined: Dec 10, 2001
Posts: 7023
|
|
I'm moving this to the Mac OS forum... [ June 16, 2004: Message edited by: Dirk Schreckmann ]
|
[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56224
|
|
JDK 1.5 is not yet available for OS X, so you can't install one. As far as everything else goes, you treat Java on OS X exactly as you would any other UNIX. Make sure your classpath is set accordingly and just use the javac and java commands on the command line (or better yet, Ant and Ant scripts). The note merely states that you should have the JAVA_HOME environment variable set appropriately as some software installations expect it to be set. [ June 16, 2004: Message edited by: Bear Bibeault ]
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Emilio Gagliardi
Greenhorn
Joined: Jun 02, 2004
Posts: 16
|
|
Make sure your classpath is set accordingly and just use the javac and java commands on the command line (or better yet, Ant and Ant scripts). The note merely states that you should have the JAVA_HOME environment variable set appropriately as some software installations expect it to be set.
I'm not sure how to do any of that actually. I don't know what an Ant script is. I would like to run my program from the command line on a mac. Where should I put my source files, where should my compiled code go and where do I stick third party jar files so that it meets Mac standards? Any advice is grately appreciated!
|
 |
Loren Rosen
Ranch Hand
Joined: Feb 12, 2003
Posts: 156
|
|
Originally posted by Emilio Gagliardi: I'm not sure how to do any of that actually. I don't know what an Ant script is. I would like to run my program from the command line on a mac. Where should I put my source files, where should my compiled code go and where do I stick third party jar files so that it meets Mac standards? Any advice is grately appreciated!
Before you run your program, you'll have to compile it. This is done using the 'javac' program, which you can call from the command line. Then to execute the resulting compiled program, use the 'java' program, again from the command line. First type this to the shell (that is, in the terminal): printenv JAVA_HOME The shell prompt will probably just print again, which indicates that JAVA_HOME isn't defined. Then type this setenv JAVA_HOME /Library/Java/Home and then try the printenv above. There's a few more steps you'll need to do but I don't have time to write them right now. The stuff in /Library/Java/Home is there for the operating system to use, in order to run java programs. Ordinarilly you would never modify it. You own java programs can go wherever you want, but perhaps most likely in some subfolder (subdirectory) of your home folder (directory). Finally, ant is program that helps you build and execute java programs (or other, non-java programs, though it's most commonly used with java). It's helpful, because there are a number of tedious steps involved, and these only get worse as your programs get bigger.
|
 |
Simon Brown
sharp shooter, and author
Ranch Hand
Joined: May 10, 2000
Posts: 1860
|
|
|
Java on Mac does work the same way, but things are installed slightly differently. It confused me to start with and I'd certainly recommend getting hold of a copy of this book.
|
 |
 |
|
|
subject: What do I need to know about Java and OS X?
|
|
|