diff -r 1024198de51f plugin/icedteanp/IcedTeaNPPlugin.cc --- a/plugin/icedteanp/IcedTeaNPPlugin.cc Tue Mar 19 15:44:43 2013 +0100 +++ b/plugin/icedteanp/IcedTeaNPPlugin.cc Tue Mar 19 16:02:11 2013 +0100 @@ -43,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -156,8 +157,14 @@ // Data directory for plugin. static std::string data_directory; -// Fully-qualified appletviewer executable. -static const char* appletviewer_executable = ICEDTEA_WEB_JRE "/bin/java"; +// Fully-qualified appletviewer default executable and rt.jar +static const char* appletviewer_default_executable = ICEDTEA_WEB_JRE "/bin/java"; +static const char* appletviewer_default_rtjar = ICEDTEA_WEB_JRE "/lib/rt.jar"; +// Fully-qualified appletviewer default executable and rt.jar +// resolved by methods in runtime. It is expected they will be the same during +//whole runtime +static std::string appletviewer_executable; +static std::string appletviewer_rtjar; // Applet viewer input channel (needs to be static because it is used in plugin_in_pipe_callback) static GIOChannel* in_from_appletviewer = NULL; @@ -284,6 +291,16 @@ #endif +static std::string get_plugin_executable(std::string& dest){ + dest = std::string (appletviewer_default_executable); + return dest; +} + +static std::string get_plugin_rt_jar(std::string& dest){ + dest = std::string (appletviewer_default_rtjar); + return dest; +} + /* * Find first member in GHashTable* depending on version of glib @@ -1517,13 +1534,14 @@ static NPError plugin_test_appletviewer () { - PLUGIN_DEBUG ("plugin_test_appletviewer: %s\n", appletviewer_executable); + + PLUGIN_DEBUG ("plugin_test_appletviewer: %s\n", get_plugin_executable(appletviewer_executable).c_str()); NPError error = NPERR_NO_ERROR; gchar* command_line[3] = { NULL, NULL, NULL }; gchar** environment; - command_line[0] = g_strdup (appletviewer_executable); + command_line[0] = g_strdup (get_plugin_executable(appletviewer_executable).c_str()); command_line[1] = g_strdup("-version"); command_line[2] = NULL; @@ -1570,7 +1588,7 @@ // Construct command line parameters - command_line.push_back(appletviewer_executable); + command_line.push_back(get_plugin_executable(appletviewer_executable).c_str()); //Add JVM args to command_line for (int i = 0; i < jvm_args->size(); i++) @@ -1581,7 +1599,7 @@ command_line.push_back(PLUGIN_BOOTCLASSPATH); // set the classpath to avoid using the default (cwd). command_line.push_back("-classpath"); - command_line.push_back(ICEDTEA_WEB_JRE "/lib/rt.jar"); + command_line.push_back(get_plugin_rt_jar(appletviewer_rtjar).c_str()); // Enable coverage agent if we are running instrumented plugin #ifdef COVERAGE_AGENT @@ -1652,10 +1670,10 @@ gchar *output = NULL; std::vector* tokenOutput = NULL; - commands.push_back(appletviewer_executable); + commands.push_back(get_plugin_executable(appletviewer_executable).c_str()); commands.push_back(PLUGIN_BOOTCLASSPATH); commands.push_back("-classpath"); - commands.push_back(ICEDTEA_WEB_JRE "/lib/rt.jar"); + commands.push_back(get_plugin_rt_jar(appletviewer_rtjar).c_str()); commands.push_back("net.sourceforge.jnlp.controlpanel.CommandLine"); commands.push_back("get"); commands.push_back("deployment.plugin.jvm.arguments"); @@ -2175,11 +2193,11 @@ } // Set appletviewer_executable. - PLUGIN_DEBUG("Executing java at %s\n", appletviewer_executable); + PLUGIN_DEBUG("Executing java at %s\n", get_plugin_executable(appletviewer_executable).c_str()); np_error = plugin_test_appletviewer (); if (np_error != NPERR_NO_ERROR) { - fprintf(stderr, "Unable to find java executable %s\n", appletviewer_executable); + fprintf(stderr, "Unable to find java executable %s\n", get_plugin_executable(appletviewer_executable).c_str()); return np_error; } @@ -2191,7 +2209,7 @@ plugin_instance_mutex = g_mutex_new (); - PLUGIN_DEBUG ("NP_Initialize: using %s\n", appletviewer_executable); + PLUGIN_DEBUG ("NP_Initialize: using %s\n", get_plugin_executable(appletviewer_executable).c_str()); plugin_req_proc = new PluginRequestProcessor(); java_req_proc = new JavaMessageSender();