Well... let me point out that "setjdk" is a bash function, not a built-in command. I found it via google. If you use bash, put the following into your .bashrc:
and you can do:
setjdk 1.7.0_55
setjdk 1.6
Note that on OS X - at least, on Mavericks - the "default Java" you have installed for running in browsers has nothing whatsoever to do with the version you are using to compile with.
Edit: to make that completely clear (I hope), I currently have two shell windows open. In one:
In the other:
If I compile in one, it uses 1.6.0_65. In the other, 1.7.0_55. And "java -jar KoLmafia-16.3.jar" will start KoLmafia using the Java runtime associated with the JDK my path says to use, whether or not the executable was compiled with it.
But, my system Java runtime, as used in Web Browsers, is 1.7.0_67
Code:
function setjdk() {
if [ $# -ne 0 ]; then
removeFromPath '/System/Library/Frameworks/JavaVM.framework/Home/bin'
if [ -n "${JAVA_HOME+x}" ]; then
removeFromPath $JAVA_HOME
fi
export JAVA_HOME=`/usr/libexec/java_home -v $@`
export PATH=$JAVA_HOME/bin:$PATH
fi
}
function removeFromPath() {
export PATH=$(echo $PATH | sed -E -e "s;:$1;;" -e "s;$1:?;;")
}
setjdk 1.7.0_55
setjdk 1.6
Note that on OS X - at least, on Mavericks - the "default Java" you have installed for running in browsers has nothing whatsoever to do with the version you are using to compile with.
Edit: to make that completely clear (I hope), I currently have two shell windows open. In one:
Code:
bash-3.2$ setjdk 1.6
bash-3.2$ java -version
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)
bash-3.2$ java -jar KoLmafia-16.3.jar
KoLmafia v16.3 r14352
Released on April 16, 2014
Currently Running on Mac OS X
Local Directory is /Users/xxx/Library/Application Support/KoLmafia
Using Java 1.6.0_65
Code:
bash-3.2$ java -version
java version "1.7.0_55"
Java(TM) SE Runtime Environment (build 1.7.0_55-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.55-b03, mixed mode)
bash-3.2$ java -jar KoLmafia-16.3.jar
KoLmafia v16.3 r14352
Released on April 16, 2014
Currently Running on Mac OS X
Local Directory is /Users/xxx/Library/Application Support/KoLmafia
Using Java 1.7.0_55
But, my system Java runtime, as used in Web Browsers, is 1.7.0_67
Last edited: