8152693: Changed behavior of java/awt/xembed/server/TestXEmbedServerJava.java test
authoryan
Wed, 06 Apr 2016 14:44:32 +0300
changeset 37564 82296146c864
parent 37563 2c09d2f09cd1
child 37565 0dfeacdb10bc
8152693: Changed behavior of java/awt/xembed/server/TestXEmbedServerJava.java test Reviewed-by: ssadetsky, serb
jdk/test/java/awt/xembed/server/TestXEmbedServerJava.java
--- a/jdk/test/java/awt/xembed/server/TestXEmbedServerJava.java	Wed Apr 06 12:25:21 2016 +0530
+++ b/jdk/test/java/awt/xembed/server/TestXEmbedServerJava.java	Wed Apr 06 14:44:32 2016 +0300
@@ -76,7 +76,23 @@
     public Process startClient(Rectangle[] bounds, long window) {
         try {
             String java_home = System.getProperty("java.home");
-            return Runtime.getRuntime().exec(java_home + "/bin/java  -XaddExports:java.desktop/sun.awt.X11=ALL-UNNAMED  JavaClient " + window);
+            boolean hasModules = true;
+            try {
+                Class.class.getMethod("getModule");
+            }catch(Exception hasModulesEx) {
+                hasModules = false;
+            }
+            if (hasModules) {
+                System.out.println(java_home +
+                               "/bin/java  -XaddExports:java.desktop/sun.awt.X11=ALL-UNNAMED "+
+                               "-XaddExports:java.desktop/sun.awt=ALL-UNNAMED  JavaClient " + window);
+                return Runtime.getRuntime().exec(java_home +
+                               "/bin/java  -XaddExports:java.desktop/sun.awt.X11=ALL-UNNAMED "+
+                               "-XaddExports:java.desktop/sun.awt=ALL-UNNAMED  JavaClient " + window);
+            }else{
+                System.out.println(java_home + "/bin/java JavaClient " + window);
+                return Runtime.getRuntime().exec(java_home + "/bin/java JavaClient " + window);
+            }
         } catch (IOException ex1) {
             ex1.printStackTrace();
         }