wood burning stoves 2.0*
The moose likes Mac OS and the fly likes How to install mutiple Java OS's on Mac? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » Mac OS
Bookmark "How to install mutiple Java OS Watch "How to install mutiple Java OS New topic
Author

How to install mutiple Java OS's on Mac?

Mike London
Ranch Hand

Joined: Jul 12, 2002
Posts: 1043
Every time Apple pushes a new Java installation, it wipes out everything on the Mac and replaces it with Apple's new version.

Therefore, I'm unable to, say, keep a Java 5 installation around.

Is my only recourse to develop on the Mac to recompile everything in Java 6?

I do not understand why Apple won't give us more control into what happens with Java installations.

Recompiling all my apps would be huge pain.

Thanks in advance for any replies.

-- Mike
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41052
    
  43
I don't think anything is wiped out - merely updated. Check the /System/Library/Frameworks/JavaVM.framework/Versions directory; mine has functional versions of Java 1.4.2, Java 1.5.0 and Java 1.6.0 in it.


Ping & DNS - my free Android networking tools app
Mike London
Ranch Hand

Joined: Jul 12, 2002
Posts: 1043
From my inspection, the Java 5 directory was wiped, but (the directory itself) left intact and turned into a link pointing to Java 6.

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60752
    
  65

That's just a symbolic link pointing to the most recent version.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41052
    
  43
That's a bummer. The ones on my machine are definitely different JVMs:

java version "1.4.2_22"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_22-b02-329)
Java HotSpot(TM) Client VM (build 1.4.2-92, mixed mode)

java version "1.5.0_22"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_22-b03-333-9M3125)
Java HotSpot(TM) Client VM (build 1.5.0_22-147, mixed mode, sharing)

java version "1.6.0_17"
Java(TM) SE Runtime Environment (build 1.6.0_17-b04-248-9M3125)
Java HotSpot(TM) 64-Bit Server VM (build 14.3-b01-101, mixed mode)
Mike London
Ranch Hand

Joined: Jul 12, 2002
Posts: 1043
Bear Bibeault wrote:That's just a symbolic link pointing to the most recent version.


True, but there's nothing left in the Java 5 directory.

Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11404
    
  81

I hadn't realized, but I have the same situation where all the previous versions (except 1.3.1) are just links:

[Edit] This is different on my PowerPC Mac: there the old versions have been kept, even though the OS is up to date:


The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11404
    
  81

Mike - what is you are trying to do?

If you are just developing and using code on your own machine then it shouldn't really matter: the code you compiled when JDK 5 was the default should run without needing to be recompiled.

If you are developing with the intent to deliver to a machine that is running an older JVM, then you could use the "-target <release>" option within javac to specify what JVM you need to support. This can also be specified in your ant build files and/or your maven pom files if needed.
Mike London
Ranch Hand

Joined: Jul 12, 2002
Posts: 1043
Andrew Monkhouse wrote:Mike - what is you are trying to do?

If you are just developing and using code on your own machine then it shouldn't really matter: the code you compiled when JDK 5 was the default should run without needing to be recompiled.

If you are developing with the intent to deliver to a machine that is running an older JVM, then you could use the "-target <release>" option within javac to specify what JVM you need to support. This can also be specified in your ant build files and/or your maven pom files if needed.


Interesting...

So in Eclipse, I'd just update the "generated class file compatibility" tab to use project-specific settings, right?

I had tried the Java compatibility setting, but that supposedly requires that JDK to be installed.

Look forward to your reply.

Thanks.

Mike
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41052
    
  43
"class file compatibility" sounds about right. From the command line (or using Ant) one would need to set both "-source" and "-target".

Of course, the code will fail on Java 5 JREs if it actually uses Java 6 methods or classes. This setting merely produces a class file that works with earlier JREs, it does not ensure that the code will actually run. So any Java 6-specific stuff needs to be wrapped in checks that ensure it's not executed on a Java 5 JRE.

That's the advantage of using an actual Java 5 JDK for compilation - it would produce errors for anything it doesn't recognize.
Mike London
Ranch Hand

Joined: Jul 12, 2002
Posts: 1043
Ulf Dittmer wrote:"class file compatibility" sounds about right. From the command line (or using Ant) one would need to set both "-source" and "-target".

Of course, the code will fail on Java 5 JREs if it actually uses Java 6 methods or classes. This setting merely produces a class file that works with earlier JREs, it does not ensure that the code will actually run. So any Java 6-specific stuff needs to be wrapped in checks that ensure it's not executed on a Java 5 JRE.

That's the advantage of using an actual Java 5 JDK for compilation - it would produce errors for anything it doesn't recognize.


Right, but, unfortunately, the Apple JDK 6 installation prevents you from keeping Java 5 too.

OK, at least I have a workaround. More work for me to make sure there's no Java 6-specific logic.

Thanks!

- Mike
 
 
subject: How to install mutiple Java OS's on Mac?
 
Similar Threads
about using 'new'
Leopard's off and running, but where's Mustang?
Where to dowload j2SE 1.4 javadoc
Why JavaFX?
OmniGraffle Vs