Skip to content
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

com.apple.eawt not working for Java 9+ #3297

Closed
chronodm opened this issue Mar 18, 2018 · 21 comments
Closed

com.apple.eawt not working for Java 9+ #3297

chronodm opened this issue Mar 18, 2018 · 21 comments
Labels
Problem A problem, bug, defect - something to fix

Comments

@chronodm
Copy link

Engine version

1.9.0.0.9687

My Operating System

macOS 10.13.3 (High Sierra)

Map name

WW2 classic 3E

Can you describe how to trigger the error? (eg: what sequence of actions will recreate it?)

Start a local game, configure AI players, click "Play"

Do you have the exact error text? Please copy/paste if so

TripleA engine version 1.9.0.0.9687
Loading map: world_war_ii_classic, from: /Users/dmoles/triplea/downloadedMaps/world_war_ii_classic-master.zip
Loading resources from the following paths: [/Users/dmoles/triplea/downloadedMaps/world_war_ii_classic-master.zip, /Applications/TripleA.app/Contents/java/app/assets]
Loading map: world_war_ii_classic, from: /Users/dmoles/triplea/downloadedMaps/world_war_ii_classic-master.zip
Loading resources from the following paths: [/Users/dmoles/triplea/downloadedMaps/world_war_ii_classic-master.zip, /Applications/TripleA.app/Contents/java/app/assets]
Error: com/apple/eawt/QuitHandler
java.lang.NoClassDefFoundError: com/apple/eawt/QuitHandler
	at games.strategy.triplea.ui.menubar.FileMenu.addExitMenu(FileMenu.java:104)
	at games.strategy.triplea.ui.menubar.FileMenu.<init>(FileMenu.java:45)
	at games.strategy.triplea.ui.menubar.TripleAMenuBar.<init>(TripleAMenuBar.java:35)
	at games.strategy.triplea.ui.TripleAFrame.<init>(TripleAFrame.java:247)
	at games.strategy.triplea.TripleA.lambda$startGame$0(TripleA.java:121)
	at games.strategy.ui.SwingAction.lambda$invokeAndWait$0(SwingAction.java:86)
	at games.strategy.ui.SwingAction.lambda$invokeAndWaitResult$1(SwingAction.java:114)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(Unknown Source)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.EventQueue.access$500(Unknown Source)
	at java.desktop/java.awt.EventQueue$3.run(Unknown Source)
	at java.desktop/java.awt.EventQueue$3.run(Unknown Source)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: com.apple.eawt.QuitHandler
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)
	at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
	... 21 more

Instead of this error, what should have happened?

Game should start

Any additional information that may help

$ java -version
java version "9.0.4"
Java(TM) SE Runtime Environment (build 9.0.4+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)
@RoiEXLab RoiEXLab added the Problem A problem, bug, defect - something to fix label Mar 18, 2018
@RoiEXLab
Copy link
Member

Just to be sure: Does this error happen using java 8 as well?

@ron-murhammer
Copy link
Member

@RoiEXLab Guessing its the same problem reported here: kaikramer/keystore-explorer#102

@ZjelcoP
Copy link

ZjelcoP commented Mar 18, 2018

Release 9824
macOS 10.12.6
Java 8
No problems

@RoiEXLab
Copy link
Member

Found the reason: http://openjdk.java.net/jeps/272
The good news: We no longer need to depend on this stupid legacy library
The bad news: It doesn't look like this feature will be backported to java 8, so we'll have to rely on reflection if we don't want to upgrade to java 9.

@RoiEXLab
Copy link
Member

As a side note: The official release date of java 10 is tomorrow.
See http://openjdk.java.net/projects/jdk/10/
Oracle announced that "Java SE 9 will be a short term release, and users should immediately transition to the next release (18.3) when available."
So if Java 10 will be available at java.com we could consider moving to a newer version of Java

@RoiEXLab RoiEXLab changed the title On macOS under Java 9, game fails to start with NoClassDefFoundError: com/apple/eawt/QuitHandler com.apple.eawt not working for Java 9+ Mar 19, 2018
@RoiEXLab
Copy link
Member

Assigning you all @DanVanAtta @ron-murhammer @ssoloff to get your opinion on how to handle this issue.
Please read my comments above to get a good picture of what's going on.

We basically have 3 options:

  1. Just ignore this for now, and wait until we can upgrade the java version and use the Desktop API from there.
  2. Try some dark reflection magic and check if TripleA is running with Java 9 or higher (too bad the version comparison classes are a java 9 feature ^^) i.e. the required methods exists and invoke them if they do.
  3. Just drop the dependency on orange-extensions, and use reflection for everything instead of partial reflection and partial "polyfilling" (not sure if this is the right term, but it reminds me of JavaScript)

@chronodm
Copy link
Author

Just my 2¢ as a developer—the reflection hack used in keystore-explorer doesn't seem completely horrible, bearing in mind there's likely to be a transition period when you need to support <= 1.8 as well as 9+, even after Oracle drops support for Java 8 next year.

@RoiEXLab
Copy link
Member

@chronodm Agreed, however we currently require users to use java 8 or higher, so incrementing the version required might not be a huge deal at all.

@ron-murhammer
Copy link
Member

@RoiEXLab I'd probably prefer to be able to support Java 8 and 9 for a while. And wait to force users to upgrade to Java 9 after a good portion have already done so through Oracle updates/etc. Otherwise we are either going to keep getting bug reports like this or we need to force Java 9 very soon which is a bit early IMO.

@chronodm
Copy link
Author

Java 9 isn’t considered a long-term support release, I don’t think, so it might be a bit harsh to force casual users to upgrade to it now.

@ron-murhammer ron-murhammer removed their assignment Mar 20, 2018
@ssoloff
Copy link
Member

ssoloff commented Mar 20, 2018

@RoiEXLab I think a pure reflection-based solution similar to what @chronodm linked would be acceptable until we dropped Java 8 support (i.e. your option (3)).

@ssoloff ssoloff removed their assignment Mar 20, 2018
@DanVanAtta
Copy link
Member

DanVanAtta commented Mar 20, 2018

We currently bundle a JDK8 for Mac+Windows with the installer. @chronodm was this reproduced by running the game after installing with the mac installer, or launching from a jar file or source? If from an installed TripleA, it would mean our bundled JDK is not being used.

@chronodm
Copy link
Author

Interesting. That was running the game after installing with the Mac installer. I'm away from that machine at the moment but when I get back to it I'll see if I can find any other configuration information that might help.

@RoiEXLab
Copy link
Member

Technically we don't bundle a JRE.
The installer is just configured to download one if the system it runs on doesn't have a JRE preinstalled.
Because we currently don't have a maximum java version, the java 9 JRE is treated as perfectly fine and therefore no additional JRE will be downloaded and the existing JRE will be used.

@ssoloff
Copy link
Member

ssoloff commented Mar 20, 2018

@RoiEXLab Should we temporarily revert the portion of 8913692 that removed Java 8 as the max version supported by the installer? We have several issues at the moment that prevent the application from running correctly on Java 9+ (most notably JDK-8199664). We can always direct users to the portable install for Java 9+ testing.

@RoiEXLab
Copy link
Member

@ssoloff probably the best option for now.

@RoiEXLab
Copy link
Member

@ssoloff We should probably also consider changing the second travis build to java 10 to ensure the code still compiles.

@RoiEXLab
Copy link
Member

@ssoloff #3304

@DanVanAtta
Copy link
Member

@RoiEXLab @ssoloff ; is this mitigated? Anything left to do? A new issue to track any open items I think would be useful to keep our task list clean. Otherwise perhaps we would want a summary of the things we would need to be java 9 / java 10 ready.

@ssoloff
Copy link
Member

ssoloff commented Sep 11, 2018

Sorry, don't have access to a Mac, so I don't know if this is still an issue. Regardless, labeling as a Java 9+ blocker.

@ssoloff ssoloff removed their assignment Sep 11, 2018
@RoiEXLab
Copy link
Member

I'm pretty sure this is still an issue, simply because in java 9+ there's an official API for this and the inofficial one we use via a hack was removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Problem A problem, bug, defect - something to fix
Projects
None yet
Development

No branches or pull requests

6 participants