The Artima Developer Community
Sponsored Link

Java Buzz Forum
Switching Between J2SE 1.4.2 and J2SE 5.0 on OS X

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Michael Cote

Posts: 10306
Nickname: bushwald
Registered: May, 2003

Cote is a programmer in Austin, Texas.
Switching Between J2SE 1.4.2 and J2SE 5.0 on OS X Posted: Jul 1, 2005 8:03 PM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Michael Cote.
Original Post: Switching Between J2SE 1.4.2 and J2SE 5.0 on OS X
Feed Title: Cote's Weblog: Coding, Austin, etc.
Feed URL: https://cote.io/feed/
Feed Description: Using Java to get to the ideal state.
Latest Java Buzz Posts
Latest Java Buzz Posts by Michael Cote
Latest Posts From Cote's Weblog: Coding, Austin, etc.

Advertisement

As noted in a previous post, we started using J2SE 5.0 (or "1.5" as everyone calls it) at work last week. Upgrading the PowerBook was pretty easy.

The anoying thing is that you have to manually go change around symlinks to start using the 5.0 compiler. To do that, you:

$ cd /System/Library/Frameworks/JavaVM.framework/Versions/
mcote-laptop:/System/Library/Frameworks/JavaVM.framework/Versions cote$ ls -l            
total 48
lrwxr-xr-x   1 root  wheel    5 Jun 29 13:44 1.3 -> 1.3.1
drwxr-xr-x   8 root  wheel  272 May 27 14:41 1.3.1
lrwxr-xr-x   1 root  wheel    5 Jun 29 13:44 1.4 -> 1.4.2
drwxr-xr-x   9 root  wheel  306 Jul  1 09:17 1.4.2
drwxr-xr-x   8 root  wheel  272 Jun 10 13:48 1.5.0
drwxr-xr-x   6 root  wheel  204 Jun 29 13:45 A
lrwxr-xr-x   1 root  wheel    1 Jun 29 13:44 Current -> A
lrwxr-xr-x   1 root  wheel    5 Jul  1 20:17 CurrentJDK -> 1.4.2
-rwxr-xr-x   1 root  wheel   50 Jun 29 21:48 to14.sh
-rwxr-xr-x   1 root  wheel   50 Jun 29 21:48 to50.sh
$ sudo unlink CurrentJDK
$ sudo ln -s 1.5.0 CurrentJDK
$ ls -l
total 48
lrwxr-xr-x   1 root  wheel    5 Jun 29 13:44 1.3 -> 1.3.1
drwxr-xr-x   8 root  wheel  272 May 27 14:41 1.3.1
lrwxr-xr-x   1 root  wheel    5 Jun 29 13:44 1.4 -> 1.4.2
drwxr-xr-x   9 root  wheel  306 Jul  1 09:17 1.4.2
drwxr-xr-x   8 root  wheel  272 Jun 10 13:48 1.5.0
drwxr-xr-x   6 root  wheel  204 Jun 29 13:45 A
lrwxr-xr-x   1 root  wheel    1 Jun 29 13:44 Current -> A
lrwxr-xr-x   1 root  wheel    5 Jul  1 20:22 CurrentJDK -> 1.5.0
-rwxr-xr-x   1 root  wheel   50 Jun 29 21:48 to14.sh
-rwxr-xr-x   1 root  wheel   50 Jun 29 21:48 to50.sh
$

And then you're using J2SE 5.0 for your compiler. Exciting!

There's another setting for which VM to use for applets and JARs. That's in Applications->Utilities->Java->J2SE 5.0->Java Preferences.

Easily Switching Back

I'm finishing up my book, JAAS in Action which is primarly done in 1.4.2. So, during the day, I want 5.0, but at night, I want the old version. I got tired of typing unlink, ln, blah, blah, so I made these little scripts that do it for me. You just have to run this with sudo, and they do the trick:

#!/bin/sh
# to14.sh
unlink CurrentJDK
ln -s 1.4.2 CurrentJDK
#!/bin/sh
# to50.sh
unlink CurrentJDK
ln -s 1.5.0 CurrentJDK

Read: Switching Between J2SE 1.4.2 and J2SE 5.0 on OS X

Topic: Open source passion? Previous Topic   Next Topic Topic: Agro the Aggregator

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use