Forum: JRuby RE: helper to switch java versions

697df6176ef55a7ea25f159e0fcdec38?d=identicon&s=25 S Ahmed (Guest)
on 2013-06-27 18:28
(Received via mailing list)
Do you guys have any tips on being able to switch between java versions,
namely 1.6 to 1.7?

I remember seeing a nice bash script that did this, it actually listed
all
the javaverions installed and let you choose which one to be active.
Caa2df9372ffa0a9e95b2bab1e8fea34?d=identicon&s=25 Karol Bucek (Guest)
on 2013-06-27 18:49
(Received via mailing list)
8c21306523b16ba5dd35c3549bf90994?d=identicon&s=25 Theo Hultberg (Guest)
on 2013-06-27 19:12
(Received via mailing list)
if you're on OS X there's java_home:

JAVA_HOME=$(/usr/libexec/java_home -v 1.6)

run `/usr/libexec/java_home -V` and it lists all installed versions.
besides filtering on version (with -v as above) you can filter 32 bit
vs.
64 bit and you can even use it to execute a specific version of java:

/usr/libexec/java_home -v 1.6 --exec java -version

T#
F1d37642fdaa1662ff46e4c65731e9ab?d=identicon&s=25 Charles Nutter (headius)
on 2013-06-27 21:36
(Received via mailing list)
Also for OS X is "pickjdk", a bit richer than java_home:

https://gist.github.com/headius/143128

This is what I use, and I think it's the one the OP was looking for
(presents a menu, etc).

- Charlie
486ca04f06d968004643ce5b47376ded?d=identicon&s=25 Keith B. (keith_b)
on 2013-06-27 22:11
(Received via mailing list)
Charlie -

What weird language is that in, and how come it's not Ruby? :)

I respect the ability to write nontrivial shell scripts, but boy, that
code
is ugly! ;)

In any case, thank you, Nick, for writing it.

- Keith



On Thu, Jun 27, 2013 at 3:33 PM, Charles Oliver Nutter
F1d37642fdaa1662ff46e4c65731e9ab?d=identicon&s=25 Charles Nutter (headius)
on 2013-06-27 22:28
(Received via mailing list)
Hah...yeah perhaps it could be Ruby, but I don't know if Ruby can
manipulate calling shell's env :-)

Anyway, there it is!

- Charlie
486ca04f06d968004643ce5b47376ded?d=identicon&s=25 Keith B. (keith_b)
on 2013-06-27 22:34
(Received via mailing list)
> ... but I don't know if Ruby can manipulate calling shell's env :-)

Oh year, there's that. ;)

- Keith



On Thu, Jun 27, 2013 at 4:23 PM, Charles Oliver Nutter
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.