oyarzun commented on a change in pull request #2015:
URL: https://github.com/apache/netbeans/pull/2015#discussion_r429574120
##########
File path:
nbi/engine/src/org/netbeans/installer/wizard/containers/SwingFrameContainer.java
##########
@@ -418,23 +419,28 @@ public void actionPerformed(ActionEvent event) {
private void initializeMacOS() {
if (SystemUtils.isMacOS()) {
- final Application application = Application.getApplication();
- if(application == null) {
- // e.g. running OpenJDK port via X11 on Mac OS X
- return;
+ if
(!initializeMacJDK("org.netbeans.installer.wizard.containers.initializeMacJDK8"))
{ // NOI18N
Review comment:
I tried changing the code to not use reflection and wrapping the
initialize in a try catch.
```java
public class InitializeMacJDK8 {
public static boolean initialize(SwingFrameContainer frameContainer)
{
try {
final Application application = Application.getApplication();
if(application == null) {
// e.g. running OpenJDK port via X11 on Mac OS X
return true;
}
application.removeAboutMenuItem();
application.removePreferencesMenuItem();
application.addApplicationListener(new ApplicationAdapter() {
@Override
public void handleQuit(ApplicationEvent event) {
frameContainer.cancelContainer();
}
});
return true;
}
catch (NoClassDefFoundError e) {
// we are running Java 9+
}
return false;
}
}
```
This did not work when running the installer on Java 11
```
2020-05-23 15:46:45.507]: An unexpected exception happened in thread main
[2020-05-23 15:46:45.507]: java.lang.NoClassDefFoundError:
com/apple/eawt/ApplicationListener
[2020-05-23 15:46:45.508]: at
org.netbeans.installer.wizard.containers.SwingFrameContainer.initializeMacOS(SwingFrameContainer.java:422)
[2020-05-23 15:46:45.508]: at
org.netbeans.installer.wizard.containers.SwingFrameContainer.initComponents(SwingFrameContainer.java:355)
[2020-05-23 15:46:45.508]: at
org.netbeans.installer.wizard.containers.SwingFrameContainer.<init>(SwingFrameContainer.java:165)
[2020-05-23 15:46:45.508]: at
org.netbeans.installer.wizard.Wizard.newWizardContainer(Wizard.java:479)
[2020-05-23 15:46:45.508]: at
org.netbeans.installer.wizard.Wizard.open(Wizard.java:509)
[2020-05-23 15:46:45.508]: at
org.netbeans.installer.Installer.start(Installer.java:124)
[2020-05-23 15:46:45.508]: at
org.netbeans.installer.Installer.main(Installer.java:61)
[2020-05-23 15:46:45.508]: Caused by: java.lang.ClassNotFoundException:
com.apple.eawt.ApplicationListener
[2020-05-23 15:46:45.508]: at
java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
[2020-05-23 15:46:45.508]: at
java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
[2020-05-23 15:46:45.508]: at
java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
[2020-05-23 15:46:45.508]: ... 7 more
[2020-05-23 15:46:45.508]: ... show message dialog
[2020-05-23 15:46:45.508]: title: Critical Error
[2020-05-23 15:46:45.508]: message: An unexpected exception happened
in thread main
[2020-05-23 15:46:45.508]:
[2020-05-23 15:46:45.509]: Exception:
[2020-05-23 15:46:45.509]: java.lang.NoClassDefFoundError:
[2020-05-23 15:46:45.509]: com/apple/eawt/ApplicationListener
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists