Closed aleksandarmilicevic closed 6 years ago
Are you running on Java 1.9?
$ 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)
$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.13.4
BuildVersion: 17E199
I saw there was already an issue on this same topic; it was closed with the excuse that there is a .pkg file that can be downloaded and installed on the Mac. The .pkg file is 6 times the size of the .jar file, so the excuse is not good enough.
Why not? Apple disbanded Java many years ago? This means you require the inclusion of a VM in any App.
What do you plan to do about this?
Apple disbanded Java many years ago?
What do you mean? I just created a simple HelloWorld.jar and java -jar HelloWorld.jar
worked perfectly fine.
What do you plan to do about this?
I plan to look at the stack trace and see why the exception happens. It looks like it's because we are trying to add some menu item to OSX's preferences menu. If Apple disbanded that part, then Alloy should simply skip that step and continue to work (not being able to add a menu item to Preferences menu is not a reason for crashing)
https://www.cnet.com/news/apple-not-committing-to-java-support-in-mac-os-x-10-7 Their last JRE supported was 1.6. You must have downloaded Java yourself unless you're running 10.6?
Apple stopped supporting their Java and left it to Oracle to provide a JRE that must be manually installed. Apple strongly advises developers to provide a JRE and you won't be able to get in their app shop without including one. (I'd like to get Alloy in the App shop one day.)
Yes, the users should install Java manually. What's new about that? That's how it's always been, not just for OSX but for all platforms.
I'm not opposed to providing a pre-bundled .pkg file that works out of the box. But for people who already have Java installed, they should be able to download just the .jar file which should work just as well (modulo some non-essential OSX-specific tweaks, like adding menu items to Preferences).
I'm still experiencing exception. 🤔
$ java -jar Alloy-5.0.0.1.jar
Exception: class java.lang.NoClassDefFoundError
Message: java.lang.NoClassDefFoundError: com/apple/eawt/ApplicationListener
Stacktrace:
class java.lang.NoClassDefFoundError: com/apple/eawt/ApplicationListener
edu.mit.csail.sdg.alloy4whole.SimpleGUI.<init>(SimpleGUI.java:1914)
edu.mit.csail.sdg.alloy4whole.SimpleGUI.<init>(SimpleGUI.java:184)
edu.mit.csail.sdg.alloy4whole.SimpleGUI$7.run(SimpleGUI.java:1880)
java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
java.base/java.security.AccessController.doPrivileged(Native Method)
java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
caused by...
class java.lang.ClassNotFoundException: com.apple.eawt.ApplicationListener
java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
edu.mit.csail.sdg.alloy4whole.SimpleGUI.<init>(SimpleGUI.java:1914)
edu.mit.csail.sdg.alloy4whole.SimpleGUI.<init>(SimpleGUI.java:184)
edu.mit.csail.sdg.alloy4whole.SimpleGUI$7.run(SimpleGUI.java:1880)
java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
java.base/java.security.AccessController.doPrivileged(Native Method)
java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
$ java -version
openjdk version "11.0.1" 2018-10-16
OpenJDK Runtime Environment 18.9 (build 11.0.1+13)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.1+13, mixed mode)
$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.14
BuildVersion: 18A391
cc @aleksandarmilicevic
Executing
java -jar alloy.jar
throws