How to change the default compiler?

I have a javac complier installed on my Mac machine. By default, its version is 7. I want to install complier version 6 by default. How to do it on a Mac?

Ive found a simulated solution for ubuntu: http://bartling.blogspot.com/2007/03/getting-java-6-to-be-default-jvm-on.html

+8
java compiler-construction shell javac macos
source share
2 answers

$ export JAVA_HOME=/usr/libexec/java_home -v '1.6*'

+8
source share

Run a command that exports your configuration:

 export JAVA_HOME=/usr/libexec/java_home -v '1.6*' 

This will continue only until you restart your computer, so be sure to include it in your configuration. I'm not an OSX user, so I'm not sure what the name of this file is, but it is basically equivalent to ".bashrc" for Linux. Just put the export line at the end of the file, so it will export it every time in the future. (This is probably the same file because they are both UNIX based)

0
source share

All Articles