summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--java/src/IceGridGUI/build.gradle14
-rw-r--r--java/src/IceGridGUI/javafx.gradle95
-rw-r--r--java/src/IceGridGUI/proguard-jar.gradle2
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Fallback.java78
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Main.java13
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/MainProxy.java100
6 files changed, 16 insertions, 286 deletions
diff --git a/java/src/IceGridGUI/build.gradle b/java/src/IceGridGUI/build.gradle
index 85adf953dd8..5d05358fad9 100644
--- a/java/src/IceGridGUI/build.gradle
+++ b/java/src/IceGridGUI/build.gradle
@@ -22,10 +22,7 @@ project.ext.javafxJar = searchFile([{System.env['JFXRT_HOME']}, { System.env['JA
project.ext.hasJavaFx = javafxJar != null
-if(project.ext.hasJavaFx) {
- apply plugin: 'application'
- apply from: 'javafx.gradle'
-} else {
+if(!project.ext.hasJavaFx) {
sourceSets {
main {
java {
@@ -65,11 +62,6 @@ project.ext.keystore_password = env['JARSIGNER_KEYSTORE_PASSWORD']
jar {
archiveName = tmpJarName
- if(!hasJavaFx) {
- manifest {
- attributes 'Main-Class': "com.zeroc.IceGridGUI.Main"
- }
- }
}
project.ext.libJars = []
@@ -141,8 +133,8 @@ if(macosx)
icon: "${projectDir}/src/main/resources/icons/icegrid.icns",
shortversion: "${project.version}",
applicationCategory: "public.app-category.utilities",
- mainclassname: "com.zeroc.IceGridGUI/MainProxy",
- copyright: "Copyright © 2005-2017 ZeroC, Inc. All rights reserved.") {
+ mainclassname: "com.zeroc.IceGridGUI/Main",
+ copyright: "Copyright © 2005-2018 ZeroC, Inc. All rights reserved.") {
classpath(file: "${libDir}/${jarName}") {
}
option(value: "-Dapple.laf.useScreenMenuBar=true") {
diff --git a/java/src/IceGridGUI/javafx.gradle b/java/src/IceGridGUI/javafx.gradle
deleted file mode 100644
index ab50d11ec11..00000000000
--- a/java/src/IceGridGUI/javafx.gradle
+++ /dev/null
@@ -1,95 +0,0 @@
-import groovy.xml.NamespaceBuilder
-
-assert project.plugins.findPlugin(JavaPlugin):
- "The Java plugin must be applied before using javafx7.gradle."
-
-assert project.plugins.findPlugin(ApplicationPlugin):
- "The Application plugin must be applied before using javafx7.gradle."
-
-def javafxJar = searchFile([{System.env['JFXRT_HOME']}, {System.env['JAVA_HOME']}, {System.properties['java.home']}],
- ['jfxrt.jar', 'lib/jfxrt.jar', 'lib/ext/jfxrt.jar', 'jre/lib/jfxrt.jar',
- 'jre/lib/ext/jfxrt.jar', 'lib/javafx-swt.jar'])
-
-def antJavafxJar = searchFile([{System.env['JFXRT_HOME']}, {System.env['JAVA_HOME']}, {System.properties['java.home']}],
- ['ant-javafx.jar', 'lib/ant-javafx.jar', '../lib/ant-javafx.jar'])
-
-if (!javafxJar) {
- throw new GradleException("Unable to locate JavaFX jar (${javafxJar}), JAVA_HOME may need to be set.")
-}
-
-if (!antJavafxJar) {
- throw new GradleException("Unable to locate JavaFX Ant jar (ant-javafx.jar), JAVA_HOME may need to be set.")
-}
-
-configurations {
- jfxrt
- jfxant
-
- sourceSets {
- main {
- compileClasspath += configurations.jfxrt
- }
- }
-}
-
-dependencies {
- jfxrt files(javafxJar)
- jfxant files(antJavafxJar)
-}
-
-run.classpath.add(configurations.jfxrt)
-
-jar {
- actions = []
-
- def antfx = NamespaceBuilder.newInstance(
- ant,
- 'javafx:com.sun.javafx.tools.ant')
-
- ant.taskdef(
- resource: 'com/sun/javafx/tools/ant/antlib.xml',
- uri: 'javafx:com.sun.javafx.tools.ant',
- classpath: configurations.jfxant.asPath)
-
- doLast {
- antfx.application(
- id: 'IceGridGUI',
- name: 'IceGrid GUI',
- mainClass: 'com.zeroc.IceGridGUI.Main',
- toolkit: 'swing')
-
- if(JavaVersion.current() == JavaVersion.VERSION_1_9) {
- antfx.application(
- id: 'IceGridGUI',
- name: 'IceGrid GUI',
- mainClass: 'com.zeroc.IceGridGUI.Main',
- toolkit: 'swing')
- } else {
- antfx.application(
- id: 'IceGridGUI',
- name: 'IceGrid GUI',
- mainClass: 'com.zeroc.IceGridGUI.Main',
- fallbackClass: 'com.zeroc.IceGridGUI.Fallback',
- toolkit: 'swing')
- }
-
- antfx.resources(id: 'IceGridGUI.resources') {
- }
-
- antfx.jar(destfile: archivePath) {
- application(refid: 'IceGridGUI')
- resources(refid: 'IceGridGUI.resources')
-
- fileset(dir: sourceSets.main.output.classesDir)
- fileset(dir: sourceSets.main.output.resourcesDir)
- }
- }
-}
-
-startScripts {
- enabled = false
-}
-
-installDist {
- enabled = false
-}
diff --git a/java/src/IceGridGUI/proguard-jar.gradle b/java/src/IceGridGUI/proguard-jar.gradle
index 087f3a5ae5a..75fefff2d48 100644
--- a/java/src/IceGridGUI/proguard-jar.gradle
+++ b/java/src/IceGridGUI/proguard-jar.gradle
@@ -30,7 +30,7 @@ task updateManifest(dependsOn: proguardJar) {
if (hasJavaFx) {
ant.jar(update: true, destfile: "${libDir}/${jarName}") {
delegate.manifest {
- attribute(name: 'Main-Class', value: 'com.zeroc.IceGridGUI.MainProxy')
+ attribute(name: 'Main-Class', value: 'com.zeroc.IceGridGUI.Main')
attribute(name: 'Built-By', value: 'Zeroc, Inc.')
}
}
diff --git a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Fallback.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Fallback.java
deleted file mode 100644
index 2142dd54188..00000000000
--- a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Fallback.java
+++ /dev/null
@@ -1,78 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-package com.zeroc.IceGridGUI;
-
-import javax.swing.JOptionPane;
-
-public class Fallback extends javax.swing.JApplet
-{
- @Override
- public void start()
- {
- try
- {
- java.net.URL jar = Fallback.class.getProtectionDomain().getCodeSource().getLocation();
-
- java.util.List<String> command = new java.util.ArrayList<>();
- command.add("java");
- command.add("-cp");
- command.add(jar.toURI().getPath());
- command.add("com.zeroc.IceGridGUI.Main");
-
- String[] args = MainProxy.args();
- for(String arg : args)
- {
- command.add(arg);
- }
-
- ProcessBuilder pb = new ProcessBuilder(command);
-
- final Process p = pb.start();
- if(p != null)
- {
- Runtime.getRuntime().addShutdownHook(new Thread()
- {
- @Override
- public void run()
- {
- while(true)
- {
- try
- {
- p.waitFor();
- break;
- }
- catch(InterruptedException ex)
- {
- }
- }
- }
- });
- }
-
- //
- // Exit from the JApplet after we have lauch IceGridGUI
- //
- System.exit(0);
- }
- catch(Exception ex)
- {
- ex.printStackTrace();
- JOptionPane.showMessageDialog(null,
- "Exception trying to start IceGrid GUI from Fallback class",
- "IceGrid GUI Error",
- JOptionPane.ERROR_MESSAGE);
- //
- // Exit from the JApplet after we have lauch IceGridGUI
- //
- System.exit(1);
- }
- }
-}
diff --git a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Main.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Main.java
index 29137d04c51..3d3dfa4d73e 100644
--- a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Main.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Main.java
@@ -29,8 +29,14 @@ public class Main extends JFrame
//
try
{
- if(System.getProperty("os.name").startsWith("Mac OS")) // macOS L&F
+ if(System.getProperty("os.name").startsWith("Mac OS"))
{
+ System.setProperty("apple.laf.useScreenMenuBar", "true");
+ System.setProperty("com.apple.mrj.application.apple.menu.about.name", "IceGrid GUI");
+
+ // To catch Command+Q
+ System.setProperty("apple.eawt.quitStrategy", "CLOSE_ALL_WINDOWS");
+
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
else if(System.getProperty("os.name").startsWith("Windows"))
@@ -48,6 +54,11 @@ public class Main extends JFrame
catch(Exception e)
{
System.err.println(e.toString());
+ JOptionPane.showMessageDialog(null,
+ e.toString(),
+ "Initialization failed",
+ JOptionPane.ERROR_MESSAGE);
+ System.exit(1);
}
SwingUtilities.invokeLater(() ->
diff --git a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/MainProxy.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/MainProxy.java
deleted file mode 100644
index fd8204c9d80..00000000000
--- a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/MainProxy.java
+++ /dev/null
@@ -1,100 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-package com.zeroc.IceGridGUI;
-
-import javax.swing.JOptionPane;
-
-public class MainProxy
-{
- public static void main(final String[] args)
- {
- //
- // Save main arguments for later usage.
- //
- _args = java.util.Arrays.copyOf(args, args.length);
-
- if(System.getProperty("os.name").startsWith("Mac OS"))
- {
- System.setProperty("apple.laf.useScreenMenuBar", "true");
- System.setProperty("com.apple.mrj.application.apple.menu.about.name", "IceGrid GUI");
-
- // To catch Command+Q
- System.setProperty("apple.eawt.quitStrategy", "CLOSE_ALL_WINDOWS");
- }
-
- String version = System.getProperty("java.version");
-
- Class<?> cls = com.zeroc.IceInternal.Util.findClass("com.javafx.main.Main", null);
- if(cls != null && version.indexOf("1.7") == 0)
- {
- try
- {
- java.lang.reflect.Method main = cls.getMethod("main", new Class[]{String[].class});
- main.invoke(null, new Object[]{args});
- return;
- }
- catch(NoSuchMethodException ex)
- {
- ex.printStackTrace();
- JOptionPane.showMessageDialog(
- null, "Unable to find method `main(String[] args)' in class `com.javafx.main.Main'",
- "IceGrid GUI Error", JOptionPane.ERROR_MESSAGE);
- }
- catch(IllegalAccessException ex)
- {
- ex.printStackTrace();
- JOptionPane.showMessageDialog(
- null,
- "IllegalAccessException invoking method `main(String[] args)' in class `com.javafx.main.Main'",
- "IceGrid GUI Error", JOptionPane.ERROR_MESSAGE);
- }
- catch(java.lang.reflect.InvocationTargetException ex)
- {
- }
- }
- cls = com.zeroc.IceInternal.Util.findClass("com.zeroc.IceGridGUI.Main", null);
- if(cls == null)
- {
- JOptionPane.showMessageDialog(null, "Unable to find class `com.zeroc.IceGridGUI.Main'",
- "IceGrid GUI Error", JOptionPane.ERROR_MESSAGE);
- return;
- }
- try
- {
- java.lang.reflect.Method main = cls.getMethod("main", new Class[]{String[].class});
- main.invoke(null, new Object[]{args});
- return;
- }
- catch(NoSuchMethodException ex)
- {
- ex.printStackTrace();
- JOptionPane.showMessageDialog(
- null, "Unable to find method `main(String[] args)' in class `com.javafx.main.Main'",
- "IceGrid GUI Error", JOptionPane.ERROR_MESSAGE);
- }
- catch(IllegalAccessException ex)
- {
- ex.printStackTrace();
- JOptionPane.showMessageDialog(
- null, "IllegalAccessException invoking method `main(String[] args)' in class `com.javafx.main.Main'",
- "IceGrid GUI Error", JOptionPane.ERROR_MESSAGE);
- }
- catch(java.lang.reflect.InvocationTargetException ex)
- {
- }
- }
-
- public static String[] args()
- {
- return _args;
- }
-
- private static String[] _args = new String[]{};
-}