OS X Mountain Lion Java version - macos

I would like to use java and javac on Mac OS X 10.8.2, but in the terminal when I ask for version with this command: java -version or javac -version it returns the following versions:
java version "1.6.0_37"
Java(TM) SE Runtime Environment (build 1.6.0_37-b06-434-11M3909)
Java HotSpot(TM) 64-Bit Server VM (build 20.12-b01-434, mixed mode)
and
javac 1.6.0_37
When I go to the settings app and tap on the Java icon in the Other section, it opens the Java Control Panel and there the jre version is 1.7.0_10
Which is used? And how can I update the java in terminal, not to use the 1.6.0 version?
Does anybody experienced this problem?

Open Java Preference App, you may find several JDKs, you can drag JDK7 to the top of the list, then re-open the shell, and invoke java -version. It will change to the JDK7.

Related

Eclipse Neon does not install on my Mac Sierra

when i tried to install Eclipse Neon on my Mac Sierra, it prompted:
Version 1.6.0_65 of the JVM is not suitable for the this product.
However when I check the java version on terminal: it says:
java -version
java version "1.8.0_112"
Java(TM) SE Runtime Environment (build 1.8.0_112-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.112-b16, mixed mode)
Anyone knows what is the issue?
Actually, the Eclipse popup window says:
Version 1.6.0_65 of the JVM is not suitable for the this product.
Version: 1.8 or greater is required.
I had the same problem. I had orginally installed the JRE, and did a search for "java" across the hard disk, and it found a JavaApplet plugin. I deleted this, and then installed the latest jdk (144) dmg. Running the eclipse installer then worked. (so, it was just a java environment problem for me).

Why can't I update Java from 1.6 to 1.7 on Coldfusion 9.0.2 on Mac OSX 10.8.5

I'm running OSX 10.8.5 and recently installed Coldfusion 9.0.2 and applied the hotfix so I'm running CF Version 9,0,2,282541 (which should be compatible with Java 1.7). My prod environment is running Java 1.7 so I'm trying to replicate that on a dev machine. The Java Version currently being used by CF is 1.6.0_65.
My dev box has Java running in multiple locations as follows:
System/Library/Java/JavaVirtualMachines/1.6.0.jdk
Library/Java/JavaVirtualMachines/jdk1.7.0_65.jdk
When I run java-version from within Terminal, I get the following:
java version "1.7.0_65"
Java(TM) SE Runtime Environment (build 1.7.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)
However, when I start CF, it reverts to 1.6.0_65:
Java Version: 1.6.0_65
Java Vendor: Apple Inc.
Java Home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Now I know that CF doesn't use the system environment variable JAVA_HOME. It uses the jvm.config argument "java.home"
When I run 'java -version' within terminal, that is using the java version that it finds in the system path, which is different from what CF can use.
Based on this, I've attempted to update my jvm.config file so that the java.home variable is now /Library/Java/JavaVirtualMachines/jdk1.7.0_65.jdk/Contents/Home/jre but even after restarting CF, it reverts to the default of 1.6.0_65 as shown below.
One interesting thing is that if I look at the Adobe_Coldfusion9_Install_Log.log, I do see the following variables (among other things) set during the installation.
java.ext.dirs:
1.) /Library/Java/Extensions
2.) /System/Library/Java/Extensions
3.) /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext
java.version: 1.6.0_65 (Java 1)
java.home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
The true question is how can I get CF to recognize changes to these if it's not looking at my jvm.config file??? How can I force it to use the "/Library/" path instead of the "System/Library" path?
This is very similar to the crazy4mustang's question posted below but it is unanswered. The only real differences is that he is running Mavericks and I'm on Mountain Lion.
Can't update Coldfusion to Java 1.7 on OSX 10.9
Disclaimer: I am not running OSX
I found a couple of articles referring to three files that need to be updated in order to change the Java path for ColdFusion running on OSX. There is this reference which is regarding ColdFusion 10 but I would assume similar locations for ColdFusion 9.
/Applications/ColdFusion10/cfusion/bin/jvm.config
/Applications/ColdFusion10/cfusion/bin/coldfusion
/Applications/ColdFusion10/cfusion/runtime/bin/wsconfig_jvm.config
In each of these, there was a setting to set the Java home path. It was set to the old location for Java 6. I updated these to point to Java 7.
Read this note from Adobe regarding ColdFusion 9.0.2, Java 1.7 and OSX
JDK 1.7 is only supported on Mac OS X 10.7 and above. See this article for more details. As ColdFusion 9.0.2 does not support Mac OS X 10.7, Cumulative Hot fix 1 does not certify ColdFusion 9.0.2 with JDK 1.7 on Mac OS X.

How to change JRE for PhpStorm on MacOs

It seems, with the latest MAcOs updates, that Java was also updated, which influenced PhpStorm performance very badly.
Anyway, I decided to update my Java.
Was
$ java -version
java version "1.6.0_51"
Java(TM) SE Runtime Environment (build 1.6.0_51-b11-457-11M4509)
Java HotSpot(TM) 64-Bit Server VM (build 20.51-b01-457, mixed mode)
After downloading Java SDK from Oracle and installing:
$ java -version
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)
But in PhpStorm it still shows the old JRE:
I also restarted my computer, but still the old JRE is shown.
Please help, how to make PHPStorm use a new JRE?
Quoting from the "Selecting the JDK version the IDE will run under" article in the Knowledge Base
posted on March 27, 2013
Mac OS X
At the moment all our products require Apple JDK 1.6 to be installed in order to run on Mac. JDK 1.7 from Oracle is not officially supported yet and has known problems that stop us from using it by default. Oracle JDK 1.7.0_40 has added support for Retina and works much better than previous versions on Mac. You are welcome to give it a try in case you have any problems with Apple JDK.
To force running under JDK 1.7 edit /Applications/.app/Contents/Info.plist file, change JVMVersion from 1.6* to 1.7* :
<key>JVMVersion</key>
<string>1.7*</string>
See this answer for the known problems with JDK 1.7.
IDEA_JDK environment variable can be used to override the selected JDK, you may need to run the product from the Terminal so that it sees your environment variables (Mac OS limitation): open -a /Applications/.app/ .
Application About dialog will show the actual JDK version.

How to run Eclipse Indigo on JDK 1.7 OSX

With the recently OSX JDK 7 ea release from Oracle. How to run Eclipse Indigo ?
I get the following error msg:
$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/JDK 1.7.0 Developer Preview.jdk/Contents/Home
$ java -version
openjdk version "1.7.0-ea"
OpenJDK Runtime Environment (build 1.7.0-ea-b211)
OpenJDK 64-Bit Server VM (build 21.0-b17, mixed mode)
$ /Applications/eclipse/Eclipse.app/Contents/MacOS/eclipse
JavaVM: requested Java version ((null)) not available. Using Java at "" instead.
JavaVM: Failed to load JVM: /bundle/Libraries/libserver.dylib
JavaVM FATAL: Failed to load the jvm library.
I just tried this myself and had some complications so I thought I would share what ended up working for me:
Download and install Mac OSX version of Java SE Development Kit 7
Under Eclipse -> Preferences -> Java -> Installed JREs, click Add, select Mac OS X VM, then click Next.
Enter "/Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home" as the JRE home directory, enter something reasonable like "Java SE 7" as the JRE name, and then click Finish. (Note that you won't be able to navigate to the "../Contents/Home" folder. You will have to type it in manually.)
After adding the new JRE to the list of Eclipse installed JREs, check the box next to the new JRE that you just added and then click OK.
Now under Eclipse -> Preferences -> Java -> Compiler, select 1.7 from the "Compiler compliance level" dropdown and click Ok.
Hope this helps someone who has problems figuring this out. The confusing part for me was selecting the JRE home directory in Eclipse, since I wasn't able to navigate to it.
The Eclipse bug is resolve in the last Eclipse 3.8 Milestone.
It's work for me.
Try this: http://twitter.com/#!/cimnine/status/126219234203271168/photo/1
Worked for me.
This is an old solution and has no relevance anymore.

What Java version comes with Mac OS X?

I have created a Java Swing application using JDK 1.6. Many customers are asking if my application can run on Mac OS X 10.5 and 10.6, so I wanted to add this question to my website's FAQs section, and I wanted an accurate answer. I am trying to answer this:
What Java version comes with Mac OS X 10.6 ?
What Java version comes with Mac OS X 10.5 ?
I know Mac OSX 10.5 comes with a Java version less than 1.6, so is there a simple way to update it to 1.6 so my program can run fine on it?
10.6.7 has:
jonatan:~ $ java -version
java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07-334-10M3326)
Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02-334, mixed mode)
for 10.5 here is the update
http://support.apple.com/downloads/Java_for_Mac_OS_X_10_5_Update_4
This release updates Java SE 6 to
version 1.6.0_13, J2SE 5.0 to version
1.5.0_19, and J2SE 1.4.2 to 1.4.2_21.
The update process is easy - the user should run: "Software Update..." from the "Apple" menu.

Resources