Installing Java on OS X

If you have a Mac with OS X Tiger, Leopard, Snow Leopard or Lion installed, chances are you already have Java pre-installed.

If you have a Mac with Mountain Lion as its first OS X version, you'll have to download and install Java 6. Do not try to use CafeTran with Java 7 yet.

If you have Java 7 and Java 6 installed, and CafeTran uses Java 7 (you can see this in the Help > About screen), you should create a script to start CafeTran with Java 6.

Here is what Jean-Christophe writes:

I added the following lines to my .bash_profile file:

alias java6="export JAVA_HOME=`/usr/libexec/java_home -v1.6`"
alias java7="export JAVA_HOME=`/usr/libexec/java_home -v1.7`"
alias java8="export JAVA_HOME=`/usr/libexec/java_home -v1.8`"

and I can now launch Start.jar with Java 1.6, I first execute "java6" on the command line, and I then use java -jar /path/to/Start.jar.

Now, if you want to do that automatically from a script, the command should be:

$ export JAVA_HOME=`/usr/libexec/java_home -v1.6`; java -jar /Users/jchelary/Downloads/CafeTran.app/Contents/Resources/Java/Start.jar

No need to specify the path to java. No need to break your system by removing Java either…

And here Will explains how to create a .bash_profile file:

You should have a command line editor installed on your system called "vi". Just open a terminal window and type the following:

vi .bash_profile

You'll then see a screen with a lot of tilde characters down the left-hand side:

~
~
~
~
~
~

Now press the "i" key on your keyboard and the word "INSERT" will appear at the bottom of the screen.

Copy and paste the following into the window:

alias java6="export JAVA_HOME=`/usr/libexec/java_home -v1.6`"
alias java7="export JAVA_HOME=`/usr/libexec/java_home -v1.7`"
alias java8="export JAVA_HOME=`/usr/libexec/java_home -v1.8`"

When you have done that, press the escape key and then press shift + : (you should now see a ":" at the bottom left of screen) and type in wq and press return.

This should save and close the file. To double check that this is been done, press the up arrow key until you see your original entry of "vi .bash_profile" and then hit return.

This should open the file and you should only see the three lines that you copied and pasted into your .bash_profile file.

To close the file, press the escape key and then press shift + : and type in wq and press return.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License