-
Notifications
You must be signed in to change notification settings - Fork 171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mac OS X: X11 installation is required to start app #29
Comments
What exact version of the Java VM are you using? I remember we had this happen with the unofficial 1.7.0-u40 build (I made a comment in #10 about it). |
It is latest available from suggested repository: |
Looks like the X11 requirement is some special issue with OpenJDK on OS X: You might try to use the 1.7.0-u45 build. We are shipping that one and it doesn't complain about X11 on a clean OS X (VM). It probably will complain about installing Java 6 though, which was discussed in #10 too. |
Beg a pardon for a stupid question. Could you please explain why we should use "unofficial jdk" instead of just official JRE from Oracle (http://www.oracle.com/technetwork/java/javase/downloads/jre7-downloads-1880261.html)? Just tried and it works perfectly with packer. Without any requirements for X11 or Java 6. And off course the game start smoothly with it (its the primary target). So what is the reason? Licensing for redistribution? Now rights to exclude some parts (reduce size)? |
A good question, actually. If it works for you - why not? From what I read at in the Java SE README Files (http://www.oracle.com/technetwork/java/javase/terms/readme/index.html), you are very much limited by Oracle about what you are required to redistribute, and what files you are allowed to exclude. Other than that I don't see any legal impediments. Maybe @badlogic can shed some light on other reasons to go with the unofficial builds. |
@titovmaxim Actually, I would rather ask the opposite question, why would you like to use Oracle Java instead of OpenJDK? You can build OpenJDK by yourself, Oracle Java and OpenJDK share more than 97% of source code but the latter has more permissive terms of use, it's possible to use OpenJDK with OpenJFX if your game requires JavaFX. My game starts smoothly with OpenJDK and I succeeded in running it under Mac OS X Yosemite (not sure about 10.6.8). As far as I know, you are allowed to remove everything from /lib/ext (but it might break NIO 2, especially JAR and ZIP support), the Java Plugin 2 and JavaFX. If you keep JavaFX, you have to respect the terms of the Oracle Binary Code License Agreement which are very annoying especially for commercial applications: |
I'm experiencing this issue as well, using the latest Packr build on Maven and running on OS X 10.10.3 Oracle JRE 7u80 and unofficial OpenJDK builds 1.7.0u45 and 1.7.0u60 have all created prompts for installing Apple's Java 6 and X11. Has anyone found a specific JRE version that plays nicely with OS X 10.10? |
@blair1618 Do you reproduce this bug when replacing the native launcher by a bash script? I'd like to determine whether it comes from Java itself or from the launcher. I can't upgrade the only Macbook Pro I can use (Macbook Pro 3.1). |
We need to modify the Info.plist and add a VMOptions section. Look i to
|
@badlogic How would it help? https://developer.apple.com/library/mac/documentation/Java/Reference/Java_InfoplistRef/Articles/JavaDictionaryInfo.plistKeys.html I assume that IDEA Info.plist relies on the system JDK, doesn't it? Would this kind of change help a bit? |
I'll try to fix this one tonight.
|
@gouessej I have no trouble running a self-contained JRE if I specifically run my jar with the |
Right now I'm just testing the simple bash replacement for the launcher. I hope it should eliminate the problem. Unfortunately I do not have non-development machine nearby (without Java installed). Something like:
|
I've tested this version with a simple script as launcher and Oracle JVM. Works perfectly without any promts for X11 or Java installation. Will stick to this solution. Parsing of config.json is not important for me in this case. |
@titovmaxim Does it work with OpenJDK 1.7 too? My own replacement in my Ant script produces a more robust bash script and includes the options contained in the JSON file. Is the "-Xdock:icon" option really necessary? I already obtain a similar effect without it, my icon appears in the dock: I use something very close to this script: |
@gouessej. Yes Xdock is really necessary. Otherwise the initially correct icon is changed by Java one. For me a single script file without json is even better. But a more universal script would be better for general use. OpenJDK asks to install X11 as usually :( So I use an Oracle one. |
Of course I don't know your requirements, but please note that using such a shell script will partially break Steam compatibility. When I tried something similar, Steam overlays stopped working. |
I completely agree. The best way would be to fix the native launcher. Shell script just shows that it is possible. However I do not have enough experience to understand which line of the launcher requires Java installation. I neither have a non-developer machine (on which we can see the problem) to debug it step-by-step and find the problem part... |
@titovmaxim Thank you. What happens when you use the same version of Oracle Java with the native launcher? Do you get the same prompt to install X11? Which version of Oracle Java do you use? Maybe our problem has nothing to do with the native launcher. |
@gouessej. Just checked again now with version 7u80 form (https://edelivery.oracle.com/otn-pub/java/jdk/7u80-b15/jre-7u80-macosx-x64.tar.gz). Works just fine with script launcher. |
@titovmaxim If Oracle Java 1.7 update 80 works just fine with the script but not with the native launcher, then the latter is to blame. X11 was necessary to build OpenJDK under Mac but I'm not sure that it is still the case now. Edit.: It's still necessary: https://wikis.oracle.com/display/OpenJDK/Mac+OS+X+Port#MacOSXPort-Minimumrequirementstorun |
Thanks for the tip about launching with a script, @titovmaxim! Do you put a copy of bash in the bundle and point CFBundleExecutable at that? Or does it work to point CFBundleExecutable directly at a .sh file? I also agree that running from the native launcher is a better solution in the long run. I've stepped through launcher.cpp in Xcode and the Java install prompt occurs here https://github.com/libgdx/packr/blob/master/native/src/launcher.cpp#L105 where it calls the function pointer to Here's a crazy idea: What if OS X has a 'fake' libjvm loaded already? They could have symbols loaded for all of libjvm's functions that just point to this install prompt, as a way of handling programs that try to use Java when no JVM is present. If this is the case, then |
@blair1618, I just named a script file like the loader was and replace it (so CFBundleExecutable points at it). I did not put a copy of bash inside. I also agree about the point when the native loader promts for the installation. Crazy idea (i'm far from Mac OS library management). What if we just rename 'libjvm' file of the bundled JRE to something crazy ('bunldled_libjvm') to avoid such collision? At least for test. |
Guys, i think your are going down the wrong path. As i said, modifying the
|
@badlogic Which options should be put into VMOptions to fix this bug? In my humble opinion, X11 shouldn't be required at runtime as I don't use AWT. I don't get why Oracle Java and OpenJDK would behave differently whereas they use exactly the same implementation of AWT. |
I think even if such option will work it could only fix (remove) Java However let us fix at least one problem. I'm curious which and how @badlogic, what was your idea? Which option should we use? |
I have found some articles about Java 6 installation popup dialog. Seems to be a bug, but there are several ways to overcome it. For example to use CFBundle API instead of dlopen. More details here: |
In my humble opinion, setting CFBundleExecutable to a .sh file instead of bin/java and avoiding to use any option (-Xdock:icon?) requiring AWT should be enough even with OpenJDK. @titovmaxim Thank you very much for investigating, this change set might be helpful: |
@gouessej, @badlogic I think I've found the solution (to avoid Java installation promt. The simplest solution is just to dlopen 'libjli.dylib' instead of 'libjvm.dylib' on Mac. No other changers required. This helps to avoid the Mac OS X bug according to http://stackoverflow.com/questions/14105575/eclipse-on-mac-10-8-installed-1-7-0-jre-jdk-but-eclipse-wont-launch#comment38546699_21766432) So I just replace the line:
with
And it works now. I think this solution is better than a script file since the third-party loaders/packers/protectors/ads can work then. |
@titovmaxim Just tried your suggestion and it works flawlessly. I'll be happy to get rid of the script hack I've been using :) |
@badlogic Was it what you meant about info.plist? http://stackoverflow.com/a/19605234 joeferner/node-java#90 (comment) |
I've seen this already. But these things are about modification of system files (e.g. under /Library/Java/JavaVirtualMachines/...) and not about our own app .plist file. So I do not know how to use them in our case. Here I'm talking solely about using a bundled jre, not a system one. |
@titovmaxim It's possible to modify the file info.plist that we provide, this is what I suggest: |
@gouessej. Beg a pardon. I understand the idea of fixing the app's .plist. But I could not understand which exact lines should be added to fix the problem. All my tryings with .plist modification have failed. Could you please post the entire .plist which solves the problem? I really want to test is ASAP. |
@titovmaxim It should be enough and you don't have to modify the executable: <key>JVMCapabilities</key>
<array>
<string>CommandLine</string>
<string>JNI</string>
<string>BundledApp</string>
</array> |
@gouessej. I've already tried this (before modifying the source code). Does not work. I've also tried to put this lines inside JavaVM dictionary. Does not work either. Actually just no effect. I think it is something wrong from my side. Could you post the ENTIRE .plist which works as an example? |
Fix for Mac OS X Java installation promt (#29)
@titovmaxim as a workaround you can use an older JRE. This one worked for me: https://bitbucket.org/alexkasko/openjdk-unofficial-builds/downloads/openjdk-1.7.0-u45-unofficial-icedtea-2.4.3-macosx-x86_64-image.zip |
This issue drove me crazy! Had to rollback to u45 now - I hope this gets fixed soon with a newer unofficial openjdk release. u80 seems broken then. Also the fix by @badlogic doesn't seem to help with u80, since it still tries to lookup /etc/X11 |
The freshly built Mac OS X app starts (Max OS X 10.9.5) lead to:
Is X11 really required to start java app? Or it is a kind of bug? Just not sure that the users will do it to run a small game.
The text was updated successfully, but these errors were encountered: