• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Jj Roberts
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Himai Minh
  • Carey Brown
  • salvin francis

How to install mutiple Java OS's on Mac?

 
Bartender
Posts: 1757
17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Rancher
Posts: 43016
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Mike London
Bartender
Posts: 1757
17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From my inspection, the Java 5 directory was wiped, but (the directory itself) left intact and turned into a link pointing to Java 6.

 
Marshal
Posts: 67478
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's just a symbolic link pointing to the most recent version.
 
Ulf Dittmer
Rancher
Posts: 43016
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Bartender
Posts: 1757
17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.

 
author and jackaroo
Posts: 12199
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:
 
Andrew Monkhouse
author and jackaroo
Posts: 12199
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Bartender
Posts: 1757
17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Rancher
Posts: 43016
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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
Bartender
Posts: 1757
17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
 
Let nothing stop you! Not even this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic