Skip to end of metadata
Go to start of metadata

Nice little script for OSX

Simply source this file while initializing your environment. This will give you two commands:

setjdk - set the jdk for just a terminal
defaultjdk - set the jdk for the system (all future terminals and java applications). Will prompt you for a password.

Each has tab completion, such as:

$ setjdk 1.<hit tab>
1.3    1.3.1  1.4    1.4.2  1.5    1.5.0

Usage

Run as follows:

$ setjdk 1.5
Setting this terminal's JDK to 1.5 ... java version "1.5.0_05"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_05-83)
Java HotSpot(TM) Client VM (build 1.5.0_05-48, mixed mode, sharing)
$ defaultjdk 1.5
Setting default JDK & HotSpot to 1.5 ... Password:
Done.

The script

Add this directly to your .bash_profile or put it in another file and source it from there.

  • No labels