If you're using Java < 1.7 on OS X and you need to use JSObject for connecting an applet to JavaScript, you can find it in in $JAVA_HOME/jre/lib/plugin.jar.
The "plugin.jar" archive doesn't seem to exist on Java 1.7 for OS X (as packaged by Oracle). There is a jfxrt.jar that seems to contain JSObject, but that unfortunately means that you can't use the same plugin.jar that you can on almost any other JDK, including 7u5 for Linux, which still has plugin.jar built right in.
In particular, this gets irritating if you're trying to use it as a compilation dependency for a build tool such as Maven, which you could otherwise do with a JAVA_HOME-relative path.
Java 7 on Mac OS X doesn't support the Java plugin. So, plugin.jar is simply not there. If you manage to find the Java 7 installation guide for Mac OS X on Oracle's website (good luck with that) you'll see:
Note that for the 7u4 release, Java plugin and Java Web start applications are not supported.
And, yes, 7u5 is out, but its release notes say it's just a bug and security fix. I'm assuming Oracle just didn't bother to update their installation notes. It looks like the 7u6 developer preview does include the plugin, so at least it's on its way.
The jfxrt.jar file is for Java FX, which is included in the Oracle Java 7 Mac OS X release. Of course, Java FX is built on top of Java applets and is intended to run via the Java plugin, so don't ask me why it would be included in Oracle's Mac OS X Java 7 release while the Java plugin itself isn't. (I guess you can build Java FX apps, you just can't run them?)
The real answer appears to be "don't use Java 7 on Mac OS X quite yet." Which may be one of the reasons Oracle extended the Java 6 EOL until November.
Plugin.jar is available on Java 7u6 for OS X, now available.
Related
I was trying to find a download for jdk 1.6 specifically for OS X. But Oracle doesn't seem to offer one. This made me wonder if the jdk 1.6 meant for Linux would work fine on OS X. I could try running it to see if it works. But I thought I'd check here to see if there are any subtle or not-so-subtle issues that I've missed.
I have an AMD-64 architecture on my mac system.
Java 6 for Mac is provided by Apple rather than Oracle, and can be downloaded from http://support.apple.com/downloads/#Java - look for the latest "Java for OSX", which at the time of writing is 2014-001.
According to the system requirements, even Java 7 requires Lion, but then I found this question: How to install java jdk 7 on Snow Leopard. Especially the answer stating that java 7 doesn't, in fact, require 10.7 and that this restriction can just be removed from the .pkg gives hope that it is possible to install even Java 8 on Snow Leopard. Any information on this?
The OS level requirements are "real" and shouldn't normally be circumvented. As to how real it is I cannot answer. Ultimately as system libraries are updated, and newer versions of JDK are compiled against them older systems won't be able to use parts of Java that use the newer functions in those libraries or even the libraries as a whole if the pointers/links have changed.
If you want to be absolutely sure Java will work on your system, you will need to compile it from source. But that is a massive pain on a Mac unfortunately. If you want to try anyway, check out the Mac Port Project over on OpenJDK.
I have just installed osx mavericks, and Java SE6 just disappeared from my system... anyway, I already have Java SE7 and I am happy with that, no need to reinstall Java SE6 since my NetBeans already works on Java7 and NetLogo too if I start it from terminal...
I am wondering how to tell the plist file of my NetLogo 5.0.4 to look for the JavaSE7 folder... any help much appreciated.
Best,
Simone
Answer
You might think that changing "1.5" to "1.7" in these Info.plist lines:
<key>JVMVersion</key>
<string>1.5+</string>
would work, but it doesn't. That's because Java 6 is from Apple but Java 7 is from Oracle, and "Apple java applications and Oracle's aren't executable compatible" (source).
Unless you want to mess with making a new NetLogo app bundle using Oracle's AppBundler tool, the simplest way to get the app running under Java 7 is to download the Linux version of NetLogo and use the supplied netlogo.sh launch script.
More info
When running headless, NetLogo has been tested thoroughly on Java 7. For headless runs, I definitely recommend Java 7 because it's faster.
The NetLogo GUI, however, hasn't been tested with Java 7. Once you get it launched, it will probably mostly work, but you might have problems or incompatibilities. We'll probably switch eventually (it's issue 197), but the work on that hasn't been done yet. That ticket would be a good place to record any problems that you find.
If you decide to fall back to Java 6, you can get it from http://support.apple.com/kb/DL1572 . (link is current as of October 2013)
I'm trying to figure out how all the different JDKs/JREs available on Mac interact. I have created a dummy Cocoa Application project in XCode 4.6 on Lion, and added the JavaVM.framework. I also added a #include just to make sure it's in the search path, and built the app.
When I try to run the app on a Mountain Lion machine, with no Java installed, OS X prompts to install Java for OS X 2013-002, and runs the application if it's installed.
To my surprise, OS X will still try to install this, even if Oracle's JRE or JDK (1.7) is already installed on the machine.
Is there a way to leave the choice to the user as to which JRE he wants to install, without loosing the fallback prompt Apple provides to let users install a JRE if they need that?
Is there a way to leave the choice to the user as to which JRE he wants to install, without loosing the fallback prompt Apple provides to let users install a JRE if they need that?
No.
JavaVM.framework is only for Apple Javas, and as you have discovered it will ignore any Oracle Java 7 JREs or JDKs that happen to be installed on the machine. Likewise, if you use Oracle's <appbundler> task to build a .app that works with Oracle Java 7 it will not use Apple Java 6. I believe the recommended approach these days is to bundle an Oracle JRE inside your .app (something <appbundler> can do for you) and use that one rather than relying on a system-wide Java installation.
I have a Java desktop application for Mac, and we are porting Java along with the application. The issue, is that the Java we are using is strictly Java6 and not Java7 (Because Java7 does not have -d32 mode).
So I downloaded Java6 jdk from the apple developer site and have bundled it in the package. And it all works well. But when I try running on other Mac's, then it throws the following error:
/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin
$ ./java -version
dyld: Library not loaded: #rpath/libjli.jnilib
Referenced from: /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/./java
Reason: image not found
Trace/BPT trap: 5
As per this, it tries searching for the respective directory at /Library/Java/JavaVirtualMachines/ and not in the folder I ported along. How can I solve this issue?
How should I port Java6 along with the application.
Secondly, the Java6 I have used is jdk as I could not find the Jre of Java6. It will be appreciated if someone can provide or share Jre6.
Does Apple licensing even allow their JRE to be redistributed with a third-party app?
I think you are making things harder than they need to be. If a user does not have Java 6 installed (possible in OS X 10.7 and 10.8), the Mac OS will automatically prompt the user to download and install it the first time a Java application tries to run. It will then automatically continue launching your app once it's installed.
Just make sure you are bundling your app appropriately for Java 6 (e.g., using the old Mac Jar Bundler app or manually creating an equivalent Info.plist) and not Java 7 (e.g., using the new Oracle appbundler.jar).