February 6, 2013

Using java 1.6 on OSX

0  comments

Since the Java support for OSX has moved from Apple to Oracle. The old Java version are no longer shown in the oracle control panel: But there is a command line tool for selecting the java version:
$ /usr/libexec/java_home -h
Usage: java_home [options...]
    Returns the path to a Java home directory from the current user's settings.

Options:
    [-v/--version   ]       Filter Java versions in the "JVMVersion" form 1.X(+ or *).
    [-a/--arch      ]  Filter JVMs matching architecture (i386, x86_64, etc).
    [-d/--datamodel ]     Filter JVMs capable of -d32 or -d64
    [-t/--task      ]          Use the JVM list for a specific task (Applets, WebStart, BundledApp, JNI, or CommandLine)
    [-F/--failfast]                  Fail when filters return no JVMs, do not continue with default.
    [   --exec       ...]   Execute the $JAVA_HOME/bin/ with the remaining arguments.
    [-R/--request]                   Request installation of a Java Runtime if not installed.
    [-X/--xml]                       Print full JVM list and additional data as XML plist.
    [-V/--verbose]                   Print full JVM list with architectures.
    [-h/--help]                      This usage information.
You can check if you have a specific java version installed with this command:
/usr/libexec/java_home -v 1.6*
If 1.6 isn't installed on your machine you can get it from here. To use Java 1.6 in command line context add this line to your ~/.bash_profile:
export JAVA_HOME=`/usr/libexec/java_home -d64 -v 1.6*`

Tags

Java, Java 1.6, Java 1.7, jvm, Mac OS X


You may also like

Blog url changed to https

I just changed the url of this blog to https://jensjaeger.com. TLS encryption is now the default for all request to this page. It might be possible that some image links on some articles are hard coded http. If you find such an error it would be nice if you leave me comment so i can

Read More

Format date and time in java with prettytime

Prettytime is a nice java library to format a java Date()s in a nice humanized ago format, like: moments ago 2 minutes ago 13 hours ago 7 months ago 2 years ago Prettytime is localized in over 30 languages. It’s super simple to use Add the dependency to your maven pom: org.ocpsoft.prettytime prettytime 3.2.7.Final or

Read More