Explanation of Java 7 configuration on OSX - osx-mountain-lion

I've been developing with Java for a long time, but only recently switched from Windows to OSX. In windows I found everything simple enough to understand. I could install the JDK to a location of choice which also included a JRE. I would then configure PATH, JAVA_HOME etc and I'd be set to go.
OSX seems quite different in its approach. Originally Java 6 came pre installed with the OS. Now I know Apple is no longer supporting that and Oracle is distributing their own version (now Java 7).
Some time ago I installed the Oracle JDK. It seems to have installed at Library/Java/ and added the java control panel to the systems preferences, updated the version of java / javac used in terminal, etc. JDK 6 still seems to be located at System/Library/Java. I'm assuming this is the old Apple version and will be left alone incase I need to use Java 6?
I have a few questions...
Firstly, is my above assessment correct?
Where is config to dictate which tools are used in terminal? There appears to be no JAVA_HOME or entry in PATH when I echo them.
Why is there a link called Home in the Java 7 directory leading back to the old Java 6 tools?
The new Java control panel in system preferences runs updates from time to time. Is this updating the JRE located at Library/Java/JavaVirtualMachines/jdk1.7.0_07/contents/home/jre? Is it also updating the JDK? I ask because after running multiple updates im not sure the version "1.7.0_07" has incremented. The current version on the Oracle site seems to be update 17.
Is there anything I'm missing here? If anyone could explain this rather confusing state of affairs I'd be most grateful!

i'll try to respond by point because you're asking things that are a bit complex.
Some time ago I installed the Oracle JDK. It seems to have installed
at Library/Java/ and added the java control panel to the systems
preferences, updated the version of java / javac used in terminal,
etc. JDK 6 still seems to be located at System/Library/Java. I'm
assuming this is the old Apple version and will be left alone incase I
need to use Java 6?
...
Firstly, is my above assessment correct?
The old version of java 6 is located under the System/library java, this version in needed by some application to run, if you were wondering which app is it using you can think about the master collection of photoshop (it requires indeed a jvm version 6 to work).
The newer version, managed by oracle, are installed under Library/Java as you pointed out.
Why is there a link called Home in the Java 7 directory leading back to the old Java 6 tools?
no idea. if comes out some suggestion it will be nice.
Where is config to dictate which tools are used in terminal? There appears to be no JAVA_HOME or entry in PATH when I echo them.
This guy here has always a lot of solution, anyhow i suggest you to not use directly the bashrc configuration files. You can spot out other solution at the oracle web site and at the general FAQ for mac users here.
They are indeed doing a bit of confusion.
Hope that this helps, in case i misunderstood the question or the answer is not complete just ask further.

Related

JRE 6 and 7 side-by-side with JRE 6 as default (Win 7)

For a migration project to migrate from Java 6 to Java 7 runtime on Windows 7, we are looking to get the following situation:
Both JRE 6 and JRE 7 are installed on the machine
JRE 6 is set as the default
JRE 7 will be explicitly requested by applets and webstart applications that require it.
We found lots of solutions that use the path to achieve a situation like this, but we are looking for a way to keep the default path (using the java.exe in C:\Windows\System). Changing the registry key \HKLM\SOFTWARE\Wow6432\JavaSoft\Java Runtime Environment\CurrentVersion to 1.6 does not work unfortunately.
Does anybody have experience with a setup like this?
Edit:
I get a lot of questions WHY we want this. I can discuss all the ins and outs, but please take it from me that we discussed all possible scenario's and this is the one that impacts our business the least. There are more than 10K systems (laptop + desktop) involved and lots of different Applets, webstart applications and standalone client applications involved.
Unfortunately the answer for Applets and web start is that this is not possible (anymore). As can be found in the JRE installer options page of Oracle, the latest JRE is chosen by the browser plugin by default:
Beginning in Java SE 6 update 10 release, the latest JRE software will be registered with all browsers. This ensures that applets will run on the latest and most secure version of the JRE software.
Some solutions can be found that suggest changing several registry keys, but these only work for versions prior to 1.6.0 update 10. As soon you install this or a newer version, those registry keys are ignored.
We are still awaiting a formal response from Oracle, but we do not expect a different outcome.
I wrote a tool to be able to run WebStart on JRE6 and JRE7 side by side.
You can download the tool here.
I had a problem that was nearly the same as yours, I wanted to use jre 6 to run an old version of sgd (sun secure global desktop). My walkaround for this :
Get firefox portable
about:config --> plugin.scan.plid.all = false (don't know if it's necessary)
Add jre portable version 6 to the folder (plugins)
Go to the Java Control Panel (in Windows Control Panel) --> Java tab --> View.. (Visualiser in french) --> Uncheck 1.7
May be just the last step will work for you...
Hope this will help someone.
I think that the answer is that there probably isn't a way to do that which is going to work for all of your existing menagerie of in-house and 3rd-party applications ... and their various ways of locating their Java platform.
And if you get something that works "most of the time" then there is a good chance that the breakage in the other cases will be worse than if you had taken a more aggressive approach to conversion.
The root problem here is in-house and 3rd-party stuff making unwarranted (and probably unnecessary) assumptions about the Java platform they are running on. If the application can't be fixed to get it to work on Java 7, it probably should be ditched ... or quarantined in a heavily fire-walled virtual machine or something. Java 6 has been EOL'ed. So unless your organization is prepared to pay big bucks for support from Oracle you won't get any more security patches. IMO, that is good enough reason to boot it out of your supported / allowed COEs ... whether the users like it or not.
It is all very well to say that there is politics in the problem. But if push comes to shove, >>you<< guys will get the blame if your "gently, gently" approach fails technically and you get security problems due to running unpatched / unpatchable Java installations.

Java Web Start in 10.8.2 with native (Apple) Java 1.6 can't find JRE

I'm trying to run a some .jnlp applications (games) on latest os-x. While doing so Java Web Start.app propose me to install Java Runtime Environment (jre_7u9). Should not that be already included in os-x, java 1.6? As an example I use Eclipse which is java-based and I have no problems running it. I'm just worried that the new version could mess up something what works fine so far (saw couple of threads where people experience problems after installation of java 7, even with the Mail application!).
I know close to nothing about java, so if someone could point me to the solution which does not involve installation of jre_7u9, it would be nice.
Thanks in advance,
Regards,
Denis.
EDIT1:
It seems that user/bin/javaws points to the wrong direction:
javaws
No Java runtime present, requesting install.
Unable to locate a Java Runtime to invoke.
that is:
/System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/javaws
If i change it to (as suggested here http://support.apple.com/kb/HT5559)
/System/Library/Frameworks/JavaVM.framework/Commands/javaws
it does work fine, however it does not help Java Web Start.app to run properly, it still requires JRE installation, which is a nonsense.
p/s/ this thread discuss the same problem. This one as well. But so far i don't see any solution to make Java Web Start to work.
A detailed guide on how to solve this problem is presented in Java for OS X 2012-006: How to re-enable the Apple-provided Java SE 6 applet plug-in and Web Start functionality.
I was having the same problem where I could run javaws from the command line, but running from Chrome/Safari/Finder did not work using Java Web Start. The problem I found is that Java Web Start is looking for a user preference that does not exist. I was able to get this working by running:
defaults write com.apple.java.JavaPreferences WebComponentsEnabled -bool true

Where did Apple's JRE 1.6 store applet runtime parameters?

We needed to roll back from Oracle's JRE 1.7 to Apple's JRE 1.6 because of the copy/paste regression. We followed these instructions from apple:
http://support.apple.com/kb/HT5559
That mostly worked, except our Java Preferences panel was gone. So we restored that from Time Machine. That mostly works (for example, changing whether the console pops open works), however, it refuses to save changes to applet runtime parameters (e.g., -Xmx1024M). There is no error, but the applet doesn't see what we put in, and if we re-start the Preferences utility, the values we set are gone.
I'll happily go edit some text file, but I cannot figure out where Apple is storing these parameters. Anybody know?
Here's where I've looked so far:
I looked at another machine, and confirmed they are not stored in ~/Library/Caches/Java/deployment.properties any more.
I also did a lot of lsof kind of searching on the new and old machines, but could not find any clues that way, either.
I searched the old machine (where the 1.7 upgrade never happened) using grep and find and also came up empty, although this search was not exhaustive.

How do I force my Java application to use Java JRE 1.6 instead of 1.7? [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How to check JRE version prior to launch?
Many people want to know how to force their program to use a minimum version of a jre, but I would like my program to only run using java 6 and not java 7 (aka maximum of jre 1.6). The reason being that my program needs to use FTP, and java 7 has the dreaded FTP bug.
Is there a way to easily make my application run using 1.6 if the user has 1.7 installed?
Some of the options I have looked at are: launch4j
I am not quite certain that it will solve my problem, other than perhaps bundling the entire jre with my program. Which I don't think is the most ideal solution.
Can someone help guide me even down the theoretical path as to how this is generally solved/handled?
As suggested in this somewhat related question/answer, use System.getProperty("java.version") to see what version of Java is being used to run the application. With this you can make the application prompt the user that he should use an older JRE.
As for running the application without path based JRE detection, the main problem is that you can't be certain where on the user's system the correct JRE is installed. On Windows there's two default possibilities, on *nix it might be anywhere.
If I were you, I'd try to find a custom FTP library that gets around the bug you mentioned to get the maximum security and optimization benefits of the newer versions of Java instead of forcing the user to stay in the past.

When viewing an Applet, why does Safari for Windows display "Java is Unavailable or Not Installed" when Java is installed and available? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
When using Safari on Windows 7 to load any page containing any Java applet, the following alert appears:
"Java is Unavailable or Not Installed. Do you want to go to a page where you can download java?"
This message is incorrect. These are developer machines with one or more instances of the Java JRE / JDK installed, including 1.7.x. Many alerts are accompanied by messages referencing a non-existent file path, similar to:
"The Java Runtime Environment cannot be loaded from
<C:\PROGRA~2\Oracle\JAVAFX~1.1RU\bin\server\jvm.dll>”
The following attempts to repair the situation have all failed:
Uninstalling and re-installing various Java versions.
Updating to the latest Java version.
Changing security settings in Safari.
Going to http://www.java.com/en/download/help/testvm.xml detects an obtuse version that is not even installed (Java 2 Runtime Environment, SE v1.4.2_19 ?!?!)
Searching the internet reveals many users with similar problems, but no answers.
How can this be resolved?
While many complaints about this problem exist online, a Google search against "Safari Windows jvm.dll JAVAFX" finds this obscure thread on the Apple Forums.
Summarized, the problem is when Safari checks the Windows Registry for a particular value, it uses the first value it finds instead of the correct value.
Steps to repair the issue:
Close all Safari windows.
Run regedit.exe
Backup your Windows registry (right-click the root Computer and select export).
Go to
32-bit Windows: HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Plug-in\
64-bit Windows: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\JavaSoft\Java Plug-in\
Examine each entry; there will probably be more than one.
Some entries reference proper JREs, while some may reference JavaFX or something else.
The JavaFX one may have been installed by Java 7.
It is likely Safari is selecting the bottom-most sorted entry; check whether the file path reference for that entry is invalid or nonexistent.
select the bad entry under ..\Java Plug-in\, cross your fingers, and delete it.
close regedit
re-open Safari and browse to a page with an applet. Give it a minute.
At this point, you should be successful. If it continues to fail, check other registry entries under the ..\Java Plug-in\ or parent subfolder ..\JavaSoft\ for invalid file paths. If you recently upgraded, a prior installation may have been invalidated, but the registry entries might not have been removed, and might have to be excised manually.
NOTE: Regarding step 4, your data may be under a different location; check the comments below for the experiences of other users who have resolved this issue in a similar fashion. Please post any alternate Windows Registry paths below as a comment.
Appreciation goes to user Olivier2011 (Olivier Lefevre) of the Apple Support Community (see first link in this answer) for following up his own question with his solution. Oliver's historical record of the incident from MarkMail.
Tried above but didn't work.
deleted java related stuff in C:\Program Files (x86)\Safari\Plugins - .jar and dll
Working now.
Actually the combination of the top answer, the explanation at: https://discussions.apple.com/thread/3192281?start=0&tstart=0 and marcus pope's windows 7 location worked for me.
That is:
I have windows 7.
When trying to run a java applet (geogebra) I got the error message that Safari
could not load C:\PROGRA~1\Oracle\JAVAFX~1.0\bin\server\jvm.dll
since the path does not exist on my machine.
This is short for: C:\Programme\Oracle\JavaFX Runtime 1.0\etc ...
Steps:
I shut down Safari.
I opened my registry and went to: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\JavaSoft\Java Plug-in.
There I found 2 folders (others have found more). The highest one was 10.5.1 and there I found a reference to the path C:\Programme\Oracle\JavaFX Runtime 1.0\etc.
I backed up my registry and then deleted this folder.
I restarted Safari and all is well.
You guys may want to look at the code that launches the applet, as it can specify which java version to run the applet in. There is a code that can be specified that says use the latest available. You also have the option to uninstall your java and resinstall it with a earlier version. Some broswers however will force you to use the latest, as there are some security risks with older versions.
Some reference links that might be of help:
Multibrowser supported applets:
https://eyeasme.com/Shayne/XHTML/appletObject.html
Applet Params: http://download.java.net/jdk8/docs/technotes/guides/jweb/applet/applet_deployment.html
This is a problem with "java online install".
To solve:
Uninstall all JavaFX and JRE in your machine.
Download "java offline install" (~=20MB).
Copy "java offline install" to Desktop.
Close all Safari windows, including the download window.
Install java.
I had similar issues with Java after installing Java 7 update 15.
I tried all the above troubleshooting methods, but they all failed (I did not have plugins referred to by the key HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\JavaSoft\Java Plug-in.).
What did work using Safari 5.1.7 was downloading an earlier version of Java (Java 7 update 11) from Oracle directly (the same version I used during the Safari 5.1.7 shelf life, when Safari 6 was Mac only).
The steps are:
Uninstall Java from machine.
Download "java offline install" (Java 7 update 11) (~=30MB).
Copy "java offline install" to Desktop.
Close all Safari windows, including the download window.
Install Java.
I tried the above methods, and the post by 'Luds' worked.
I did have a plugin referred to by the key HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\JavaSoft\Java Plug-in (for Java 7 update 17)
but after I uninstalled JAVA 7 Update 17 from the windows control panel, it removed this entry.
I tried Java 7 Update 17, 15, 13 with no luck.
What worked for Safari 5.1.7 was downloading an earlier version of Java (Java 7 update 11) from Oracle directly like the poster 'Luds' mentioned.
The steps are:
Uninstall current Java from machine.
Download jre-7u11-windows-x64.exe (Java 7 update 11) (~=30MB) from:
http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase7-521261.html#jre-7u11-oth-JPR
Copy the flavor of installer you need to Desktop.
Close all open Safari windows,
including the download window.
Install Java SE Runtime Environment 7u11 (Java 7 update 11).

Resources