changeset 198:62011060e7ea

Set class path to JRE/lib/rt.jar for both plugin and javaws.
author Denis Lila <dlila@redhat.com>
date Tue, 05 Apr 2011 12:07:10 -0400
parents 30276d468815
children 9c89214b7ef6
files ChangeLog Makefile.am launcher/javaws.in plugin/icedteanp/IcedTeaNPPlugin.cc
diffstat 4 files changed, 45 insertions(+), 41 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Apr 01 12:57:18 2011 -0400
+++ b/ChangeLog	Tue Apr 05 12:07:10 2011 -0400
@@ -1,3 +1,14 @@
+2011-04-05  Denis Lila  <dlila@redhat.com>
+
+	* plugin/icedteanp/IcedTeaNPPlugin.cc
+	(plugin_start_appletviewer): Replace hardcoded indices
+	with a variable; roll up free calls in a loop; fix whitespace;
+	set classpath to ICEDTEA_WEB_JRE/lib/rt.jar.
+	* launcher/javaws.in:
+	Set class path to JRE/lib/rt.jar.
+	* Makefile.am:
+	Replace @JRE@ with $(JRE) in edit_launcher_script.
+
 2011-04-01  Denis Lila  <dlila@redhat.com>
 
 	* plugin/icedteanp/java/sun/applet/PluginDebug.java: 
--- a/Makefile.am	Fri Apr 01 12:57:18 2011 -0400
+++ b/Makefile.am	Tue Apr 05 12:07:10 2011 -0400
@@ -115,7 +115,8 @@
   -e 's|[@]LAUNCHER_BOOTCLASSPATH[@]|$(LAUNCHER_BOOTCLASSPATH)|g' \
   -e 's|[@]JAVAWS_BIN_LOCATION[@]|$(bindir)/javaws|g' \
   -e 's|[@]ITWEB_SETTINGS_BIN_LOCATION[@]|$(bindir)/itweb-settings|g' \
-  -e 's|[@]JAVA[@]|$(JAVA)|g'
+  -e 's|[@]JAVA[@]|$(JAVA)|g' \
+  -e 's|[@]JRE[@]|$(JRE)|g'
 
 # Top-Level Targets
 # =================
--- a/launcher/javaws.in	Fri Apr 01 12:57:18 2011 -0400
+++ b/launcher/javaws.in	Tue Apr 05 12:07:10 2011 -0400
@@ -6,6 +6,7 @@
 CLASSNAME=net.sourceforge.jnlp.runtime.Boot
 BINARY_LOCATION=@JAVAWS_BIN_LOCATION@
 PROGRAM_NAME=javaws
+CP=@JRE@/lib/rt.jar
 
 JAVA_ARGS=
 ARGS=
@@ -24,6 +25,7 @@
 
 ${JAVA} ${LAUNCHER_BOOTCLASSPATH} ${LAUNCHER_FLAGS} \
   ${JAVA_ARGS} \
+  -classpath ${CP} \
   -Dicedtea-web.bin.name=${PROGRAM_NAME} \
   -Dicedtea-web.bin.location=${BINARY_LOCATION} \
   ${CLASSNAME} \
--- a/plugin/icedteanp/IcedTeaNPPlugin.cc	Fri Apr 01 12:57:18 2011 -0400
+++ b/plugin/icedteanp/IcedTeaNPPlugin.cc	Tue Apr 05 12:07:10 2011 -0400
@@ -1541,34 +1541,40 @@
   gchar** command_line;
   gchar** environment;
 
+  int cmd_num = 0;
   if (plugin_debug)
   {
-      command_line = (gchar**) malloc(sizeof(gchar*)*9);
-      command_line[0] = g_strdup(appletviewer_executable);
-      command_line[1] = g_strdup(PLUGIN_BOOTCLASSPATH);
-      command_line[2] = g_strdup("-Xdebug");
-      command_line[3] = g_strdup("-Xnoagent");
+      command_line = (gchar**) malloc(sizeof(gchar*)*11);
+      command_line[cmd_num++] = g_strdup(appletviewer_executable);
+      command_line[cmd_num++] = g_strdup(PLUGIN_BOOTCLASSPATH);
+      // set the classpath to avoid using the default (cwd).
+      command_line[cmd_num++] = g_strdup("-classpath");
+      command_line[cmd_num++] = g_strdup_printf("%s/lib/rt.jar", ICEDTEA_WEB_JRE);
+      command_line[cmd_num++] = g_strdup("-Xdebug");
+      command_line[cmd_num++] = g_strdup("-Xnoagent");
       if (plugin_debug_suspend)
       {
-          command_line[4] = g_strdup("-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y");
+          command_line[cmd_num++] = g_strdup("-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y");
       } else
       {
-          command_line[4] = g_strdup("-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n");
+          command_line[cmd_num++] = g_strdup("-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n");
       }
-      command_line[5] = g_strdup("sun.applet.PluginMain");
-      command_line[6] = g_strdup(out_pipe_name);
-      command_line[7] = g_strdup(in_pipe_name);
-      command_line[8] = NULL;
-   } else
-   {
-       command_line = (gchar**) malloc(sizeof(gchar*)*6);
-       command_line[0] = g_strdup(appletviewer_executable);
-       command_line[1] = g_strdup(PLUGIN_BOOTCLASSPATH);
-       command_line[2] = g_strdup("sun.applet.PluginMain");
-       command_line[3] = g_strdup(out_pipe_name);
-       command_line[4] = g_strdup(in_pipe_name);
-       command_line[5] = NULL;
-   }
+      command_line[cmd_num++] = g_strdup("sun.applet.PluginMain");
+      command_line[cmd_num++] = g_strdup(out_pipe_name);
+      command_line[cmd_num++] = g_strdup(in_pipe_name);
+      command_line[cmd_num] = NULL;
+  } else
+  {
+      command_line = (gchar**) malloc(sizeof(gchar*)*8);
+      command_line[cmd_num++] = g_strdup(appletviewer_executable);
+      command_line[cmd_num++] = g_strdup(PLUGIN_BOOTCLASSPATH);
+      command_line[cmd_num++] = g_strdup("-classpath");
+      command_line[cmd_num++] = g_strdup_printf("%s/lib/rt.jar", ICEDTEA_WEB_JRE);
+      command_line[cmd_num++] = g_strdup("sun.applet.PluginMain");
+      command_line[cmd_num++] = g_strdup(out_pipe_name);
+      command_line[cmd_num++] = g_strdup(in_pipe_name);
+      command_line[cmd_num] = NULL;
+  }
 
   environment = plugin_filter_environment();
 
@@ -1590,25 +1596,9 @@
 
   g_strfreev (environment);
 
-  g_free (command_line[0]);
-  command_line[0] = NULL;
-  g_free (command_line[1]);
-  command_line[1] = NULL;
-  g_free (command_line[2]);
-  command_line[2] = NULL;
-  g_free (command_line[3]);
-  command_line[3] = NULL;
-  g_free (command_line[4]);
-  command_line[4] = NULL;
-
-  if (plugin_debug)
-  {
-      g_free (command_line[5]);
-      command_line[5] = NULL;
-      g_free (command_line[6]);
-      command_line[6] = NULL;
-      g_free (command_line[7]);
-      command_line[7] = NULL;
+  for (int i = 0; i < cmd_num; i++) {
+    g_free (command_line[i]);
+    command_line[i] = NULL;
   }
 
   g_free(command_line);