-
Notifications
You must be signed in to change notification settings - Fork 167
OS X Yosemite still asks to install JRE 6 #9
Comments
As an update, I did find that if I rename the key "Java" to "JavaX", and then replace every section in your script that refers to key ":Java" with ":JavaX" (i.e. in the section where you find what PList version we are using and where you extract the keys from the Apple version) then it works exactly as it should. So, it is obvious that whatever Mavericks is doing, it is switching on the Java key in Apple formatted Info.plist files to do its thing. I have my changes integrated into my ant task (I use a 'replace' task to rename the Java key to JavaX, and I have manually changed your script to match), so there is no ongoing maintenance needed. I would consider this to be a successful workaround, as far as 'just getting it done' is concerned. However I would love to hear if others have had this same problem, and how they have resolved it. I can't be alone in this issue, and if there is a better way to do this, I am all ears! (In case anyone is interested, the project in question that I am doing this for is Buddi - http://buddi.digitalcave.ca/ ) Cheers |
@thebiguno, I tried this project out and it didn't work for me - likely I was running into the same problem that you saw. Just to confirm you're not alone! Up till now I haven't found a workaround. I will see if I can get what you suggest working, though it's not easy for me to test stuff since I don't have easy access to any Macs (I'm developing multiplatform code for third parties). |
Wow, thanks for the research, @thebiguno ! I've recently had a bug report with these symptoms, but couldn't reproduce it on Yosemite with Oracle Java 7. Until now I never had any trouble using my Java stub with Java 7. But if this issue is getting bigger, what possibilities do we have to support both Apple Java 6 and Oracle Java 7/8 with one generic plist file? Another plist structure only for this project / stub file? don't like the idea very much... I'll definately digg deeper into the stuff in the next couple of weeks. Very busy at the moment. |
Note to myself: Feedback from another user with the same issues:
|
Since I am really happy with this neat solution, because it helped me to bring back the Mac application to my users of SikuliX (http://sikulix.com and https://github.com/RaiMan/SikuliX-2014), I want to talk about my approach, that works with Java 7, 6 and 8 on OS X 10.7 to 10.10.1:
This is it:
|
So, yes by avoiding use of the key "Java" it appears to work for all the combinations of OSX and java installations that I've been able to get people to try. I'll probably stick with this, unless I find it's not working in some cases. However if I understand what's going on correctly, using this solution the (renamed) java-specific parts of the Info.plist file aren't doing much useful work - it would probably be cleaner to hard code the details of the java launching code in the "stub" script instead of burying them in the plist file under a custom key and pulling them out again using PlistBuddy. I'll keep an eye on this project in case a cleaner solution emerges - in any case, thanks for writing something that explains what the application bundle is doing in a way that gives me a chance to work round it! |
You are probably right that it would be cleaner in a different way; however by renaming Java to JavaX you can keep your existing build scripts the same (in my case, the use of the bundle jar ant task) and just make a single line replacement after the fact. Other than that, there is not really any advantages that I can think of. |
The previous commit doesn't seem to help. A comment from another UniversalJavaApplicationStub user here: tofi86/universalJavaApplicationStub#9 suggests that OSX is doing some magic with the Java part of the Info.plist file that stops this approach working. This commit (currently untested) changes the name of the relevant section in the Info.plist file from Java to JavaUJAS (in accordance with the suggestion above). However, looking at the stub script, this is really pretty pointless - if I want the thing to work with both legacy (Apple) java 6 and current (Oracle) java 7+, I could just write my own stub script which doesn't pull java config out of the Info.plist file. But it might be better to use Oracle's AppBuilder, or just to hardwire the relevant files for the TOPCAT.app directory. Looking at what JarBundler does, which is probably not very different from AppBuilder, it's not exactly magic.
From a naive look, this appears to be the exact same issue I solved here. All of the symptoms I encountered matched yours, especially being able to launch from the script via command line but not double clicking the app. |
Thanks for the comment! However I think that the problem is a bit different... the problem I was experiencing was that the universalJavaApplicationStub program was not even being executed; the OS would just execute the Java program with some default JRE, without referencing my startup program at all. By changing the tag in the .plist file to (or anything other than Java), then the startup script would be executed. I apologize if I mis-read your issue, though. Cheers |
Well, mine was actually a combination of 2 different issues, the one I linked to, and then also one that Tobias just fixed, but as you say yours does appear to be different. Still, it can't hurt to try a file with both of the fixes for those 2 issues stuck in there. It could be that OSX is doing something funky purely because of the breakage. For example, your echo test I wouldn't consider valid, since I tried the exact same thing and had the exact same result as you, but my fixes "fixed" that as well. That said, it wouldn't surprise me in the least if Apple did something stupid with Yosemite, since the highest I tested on was Mountain Lion. |
At the moment, I don't have my companies dev mac around with Yosemite and without Java 6, so I'd like you to test the stub file in version 0.8.0 which I released a few minutes ago.
Cheers, |
Just for CYA, I hope it fixes it ;) I haven't yet received any testing results from users of Mavericks or Yosemite on my project though. |
And, no sooner did I post the above CYA than I got this response from a user:
|
Great! So adding a <key>JVMVersion</key>
<string>1.6+</string> and using |
Well, In my case, on my companies dev machine, the java 7 installation isn't listed in If I run the script on the commandlien, the Renaming the Plist key |
Well, that's odd... something went wonky with your install of /usr/libexec/java_home doesn't list it at all. Maybe installed as a "per user" thing, rather than system wide? |
Installed both JRE 7 and JRE 8 now, but I'm not able to install both versions parallel and neither of them creates an entry in At http://apple.stackexchange.com/a/160216 they say, this is because On the other hand I have Mac systems with Apple JRE 6 and Oracle JRE 7 where both versions are listed in |
Alright, so I installed the JDK 8 now in a last attempt to solve this issue, and here we go:
However, no "normal" user would install the JDK - they will get pointed to the JRE by Oracle... Also, this JVM get's picked up by the So this issue really seems to be related a 100% to the |
Actually, per Oracle's own documentation you have to install the JDK for anything other than web usage. That explains a lot though. |
Yes, it does... But most people will only install Java from java.com, so using the standard JRE... :-/ |
Well, don't even get me started on Apple dropping official support for Java and all the issues that has caused... I don't think you want a half informed tirade [half cause I develop for Apple, but don't own one] |
Same thing here. universalJavaApplicationStub runs ok from the command line, but double clicking brings up the pesky "Install Java 6". Only VM installed is Oracle 1.8.31. |
Are you guys trying to latest official code? Cause regarding aleth's comment, it should be JVMVersion, not JMVersion. The easiest way to get the correct functionality is to use the latest code instead of hand editing your own. This will prevent simple mistakes such as typos and the like. |
Yes, I am using the latest code. |
@aleth Okay, your post-reboot functionality is what should be happening for the issue with the current code. Thanks. |
@aleth Umm, yeah, you're suppsed to be using 1.7+, not 1.6+. Obviously it'll look for a 1.6 JVM if you tell it that's what version you want. |
|
@tofi86 It should, but obviously doesn't. I haven't yet figured out why. It's... flaky. Of course, it should really be your_min_version+ anyway. So if you compile against 1.6, then yes, 1.6 is appropriate I guess. Except for not working right in the detection of course. |
@fubar4 Not at all true. I don't have Apple Java installed anywhere on either of my Macs, and all of this works just fine. |
@fubar4 @Dylan-M Thank you. I installed Legacy Java 6 and I saw the stub error "No suitable Java version found on your system!" (my app requires 1.7+); consequently I installed JRE 1.8.0_101 and now the application starts fine using universalJavaApplicationStub 1.0.1 (master version). It seems so stupid to have to install the Legacy version, but I don't understand if there's a way to avoid it. |
I have a feeling this is related to one of my previous posts: The Oracle JRE for OSX is only intended to be used as a browser plugin. To have full Oracle support on OSX you need to install the JDK instead. It's dumb, but since I'm a developer I have it anyway. I don't see any of the issues you're describing, and I don't have Apple java in any form on my machine. |
I restored a clean El Capitan installation and installed only JDK 1.8.0_101, but when I click on the app icon I got always the OS X message that ask me to install Legacy Java 6. I noted that if I launch manually the stub from bash, the application starts. I think that when OS X sees |
Alberto, You are not alone. I am seeing the same from clean installs of -Brett On Mon, Oct 10, 2016 at 7:26 AM, Alberto [email protected] wrote:
|
You've both missed a key instruction if you're still using the Java key. From the Readme:
And also from the readme:
|
@Dylan-M was a bit faster than me and is absolutely right: When you use the "old" |
As a test, you can manually change the Java key to JavaX in your program's plist to see if it works. Also, @tofi86: If I haven't thanked you lately, this is me doing so ;) You've made life considerably easier when it comes to OSX packaging. |
@Dylan-M: Thanks a lot! Really appreciate your feedback :-) Also stay tuned for version 1.1 which brings localization of error messages, a better search algorithm for specified Java versions, better support for Oracle JRE plugin 1.8.0_101, etc.. |
Thank you a lot! Solved adding |
Clearly I've been doing something wrong. I think it is this:
I'm not using either the JarBundler or AppBundler. Instead, I have an What's special about the bundlers that makes them necessary? -Brett On Mon, Oct 10, 2016 at 8:19 AM, Alberto [email protected] wrote:
|
@fubar4 Well, for one it makes sure to include everything the plist should have. But, I was just using a manually created app until recently. It's all a matter of structure. If you structure it correctly, then it'll work. If you don't... it won't work correctly. |
@fubar4 This is my working <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<plist version="1.0">
<dict>
<key>CFBundleName</key>
<string>Earthquake Bulletin</string>
<key>CFBundleShortVersionString</key>
<string>1.0.0</string>
<key>CFBundleAllowMixedLocalizations</key>
<string>false</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleExecutable</key>
<string>universalJavaApplicationStub</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleIconFile</key>
<string>earthquake-bulletin.icns</string>
<key>JavaX</key>
<dict>
<key>MainClass</key>
<string>it.albertus.earthquake.EarthquakeBulletin</string>
<key>JVMVersion</key>
<string>1.7+</string>
<key>ClassPath</key>
<array>
<string>$JAVAROOT/earthquake-bulletin.jar</string>
<string>$JAVAROOT/lib\jface-utils-6.0.0.jar</string>
<string>$JAVAROOT/lib\org.eclipse.core.commands_3.7.0.v20150422-0725.jar</string>
<string>$JAVAROOT/lib\org.eclipse.core.jobs_3.7.0.v20150330-2103.jar</string>
<string>$JAVAROOT/lib\org.eclipse.equinox.common_3.7.0.v20150402-1709.jar</string>
<string>$JAVAROOT/lib\org.eclipse.jface_3.11.1.v20160128-1644.jar</string>
<string>$JAVAROOT/lib\org.eclipse.osgi_3.10.102.v20160118-1700.jar</string>
<string>$JAVAROOT/lib\org.eclipse.paho.client.mqttv3-1.1.0.jar</string>
<string>$JAVAROOT/lib\swt-4.5.2-cocoa-macosx-x86_64.jar</string>
</array>
<key>VMOptions</key>
<string>-Xms8m -Xmx32m</string>
<key>StartOnMainThread</key>
<true/>
</dict>
</dict>
</plist> |
@fubar4 of course you don't have to use one of the bundlers and instead build the Plist file manually. However, make sure that the structure is in compliance with the JarBundler standard (old Apple standard) or the Oracle standard. To solve the nasty java 6 dialog, make sure you use the If you still think that it should work but it doesn't, please post the content of your Plist file here. |
Yeah, the only issue I'm having now is getting the "Working Directory" to be set correctly via the PList. Everything else works using JarBundler 3.3.0, including solving every issue referenced in this thread. |
@fubar4 looks quite right. and what's the terminal output of |
@tofi86 That PList was from @albertus82 not @fubar4 heh |
confusion... 😕 Still, for further investigation, please send the contents of your |
Interestingly, I posted them both last November. @Dylan-M seems to be right then (mentioning 1.8+) and now, so I'm guessing $> plutil Info.plist It looks OK above, but that command was run using a plist without a -Brett -Brett On Mon, Oct 10, 2016 at 11:16 AM, Tobias Fischer [email protected]
|
Sorry, a difference in what I see today: brett@mac:~$ find / -type f -name java 2>/dev/null brett@mac:~$ /usr/libexec/java_home -V Default Java Virtual Machines (0): No Java runtime present, try --request to install. On Mon, Oct 10, 2016 at 12:00 PM, Brett Lee [email protected] wrote:
|
@fubar4 "usejavaxkey" isn't a part of the plist, it's an instruction to AppBundler or JarBundler to use this (Note the JavaX, if that's just Java in your file it'll ask to use Apple Java 1.6): <key>JavaX</key>
<dict>
<key>MainClass</key>
<string>it.albertus.earthquake.EarthquakeBulletin</string>
<key>JVMVersion</key>
<string>1.7+</string>
<key>ClassPath</key>
<array>
<string>$JAVAROOT/earthquake-bulletin.jar</string>
<string>$JAVAROOT/lib\jface-utils-6.0.0.jar</string>
<string>$JAVAROOT/lib\org.eclipse.core.commands_3.7.0.v20150422-0725.jar</string>
<string>$JAVAROOT/lib\org.eclipse.core.jobs_3.7.0.v20150330-2103.jar</string>
<string>$JAVAROOT/lib\org.eclipse.equinox.common_3.7.0.v20150402-1709.jar</string>
<string>$JAVAROOT/lib\org.eclipse.jface_3.11.1.v20160128-1644.jar</string>
<string>$JAVAROOT/lib\org.eclipse.osgi_3.10.102.v20160118-1700.jar</string>
<string>$JAVAROOT/lib\org.eclipse.paho.client.mqttv3-1.1.0.jar</string>
<string>$JAVAROOT/lib\swt-4.5.2-cocoa-macosx-x86_64.jar</string>
</array>
<key>VMOptions</key>
<string>-Xms8m -Xmx32m</string>
<key>StartOnMainThread</key>
<true/>
</dict> |
@Dylan-M Thanks so much for your confirmation that the use of "usejavaxkey" Interestingly, when I run this command, I see the application start up $ ./Contents/MacOS/universalJavaApplicationStub But the output (above) has me a bit confused. Attempting to start the same instance of the application by 2x clicking the -Brett On Mon, Oct 10, 2016 at 12:25 PM, Dylan Myers [email protected]
|
@albertus82 - Sorry for missing it - just saw that you had posted a full -Brett On Mon, Oct 10, 2016 at 11:00 AM, Alberto [email protected] wrote:
|
@fubar4 At first I couldn't reproduce the issue on my Mac (macOS 10.11 "Sierra"). But then I did some tests with an existing demo app of mine which contained the Can you ty and rename your demo app to exclude caching issues as the root of your problems? Thanks. |
Also, for future reference, you can clear all cached data about an app using this command:
Or, clear all data for your entire app cache using this command:
Yes, I know my Power User is showing, but I'm hoping this helps others ;) |
Hi Tobias, I really appreciate you taking some time to look into this. I renamed the application and saw the same result - the dreaded prompt for -Brett On Tue, Oct 11, 2016 at 10:42 AM, Tobias Fischer [email protected]
|
Having since written that "com.apple.eawt." was not the problem, I'm now |
@tofi86 - Adding to what @Dylan-M wrote, I would also like to that you for @Dylan-M https://github.com/Dylan-M - Thank you also for your helpfulness The application is available at https://www.trustpds.com On Mon, Oct 10, 2016 at 7:58 AM, Dylan Myers [email protected]
|
* Old jarbundler with config would cause OSX to prompt for Java SE 6 * Using a new java app stub script, it will now launch for JVM 1.8+ See: tofi86/universalJavaApplicationStub#9
Hello,
I have recently found this project when researching a problem reported by users, that OSX Yosemite will request the install of JRE 6 when running my application. Your script sounds like it would fix things, however I am still seeing the same issue. Digging further, it appears that OS X is intercepting the app bundle execution even before passing control to your script. (To verify this, I added a line 'echo "foo" > "~/bar.txt"', and it doesn't appear when double clicking on the application, but if I run the script directly from the command line, the file appears and the app launches properly).
If I remove the "Java" tag in the Info.plist file, your script is executed (and then complains about a missing main class, as expected). So, it appears to me that OSX is intercepting execution before the JavaApplicationStub is executed, IF there is a "Java" key in the Info.plist.
(For the record, I am using the latest version of JarBundler ant task - 2.3.1 - and it appears to be writing Info.plist in the Apple format. I have installed the latest JRE from Oracle - 8 update 25.)
Have you seen this problem before? Any thoughts on what I can try next? I'm sure that I can get it working by hacking your script plus the Info.plist file, but I would like to keep things as close to normal as possible (for whatever constitutes 'normal' in the ever-changing landscape of Apple / Java relations!)
Any thoughts on this would be greatly appreciated.
Cheers
The text was updated successfully, but these errors were encountered: