Index: /trunk/icedtea-web/Config.kmk
===================================================================
--- /trunk/icedtea-web/Config.kmk	(revision 430)
+++ /trunk/icedtea-web/Config.kmk	(revision 431)
@@ -9,6 +9,6 @@
 PACKAGE_NAME       := icedtea-web
 PACKAGE_VER_MAJOR  := 1
-PACKAGE_VER_MINOR  := 3
-PACKAGE_VER_PATCH  := 0
+PACKAGE_VER_MINOR  := 5
+PACKAGE_VER_PATCH  := 1
 PACKAGE_VERSION    := $(PACKAGE_VER_MAJOR).$(PACKAGE_VER_MINOR).$(PACKAGE_VER_PATCH)
 PACKAGE_STRING     := $(PACKAGE_NAME) $(PACKAGE_VERSION)
@@ -30,5 +30,5 @@
 #ICEDTEA_WEB_DATA_DIR    := /@unixroot/usr/share/$(PACKAGE_NAME)
 
-ICEDTEA_WEB_JRE     = icedtea_web_jre_dir()
+ICEDTEA_WEB_JRE     = ""
 
 #
@@ -39,8 +39,6 @@
 #  - we want full privileges
 #
-LAUNCHER_BOOTCLASSPATH  = \"-Xbootclasspath/a:%s/netx.jar$(RHINO_RUNTIME)\", \
-                          icedtea_web_data_dir()
-PLUGIN_BOOTCLASSPATH    = \"-Xbootclasspath/a:%s/netx.jar;%s/plugin.jar$(RHINO_RUNTIME)\", \
-                          icedtea_web_data_dir(), icedtea_web_data_dir()
+LAUNCHER_BOOTCLASSPATH  = \"-Xbootclasspath/a:%s/netx.jar$(RHINO_RUNTIME)\"
+PLUGIN_BOOTCLASSPATH    = \"-Xbootclasspath/a:@DATADIR@/netx.jar;@DATADIR@/plugin.jar$(RHINO_RUNTIME)\"
 
 # Fake update version to work with the Deployment Toolkit script used by Oracle
Index: /trunk/icedtea-web/netx/Makefile.kmk
===================================================================
--- /trunk/icedtea-web/netx/Makefile.kmk	(revision 430)
+++ /trunk/icedtea-web/netx/Makefile.kmk	(revision 431)
@@ -61,5 +61,5 @@
 	(cd $(netx_0_OUTDIR); \
         $(PATH_BOOTSTRAP_JDK)/bin/jar cfm $(netx_JARFILE) \
-            $(netx_MANIFEST) javax/jnlp net)
+            $(netx_MANIFEST) javax/jnlp net sun)
 
 netx: $$(netx_JARFILE)
Index: /trunk/icedtea-web/plugin/icedteanp/IcedTeaNPPlugin.cc
===================================================================
--- /trunk/icedtea-web/plugin/icedteanp/IcedTeaNPPlugin.cc	(revision 430)
+++ /trunk/icedtea-web/plugin/icedteanp/IcedTeaNPPlugin.cc	(revision 431)
@@ -221,10 +221,4 @@
 
 #ifdef __OS2__
-struct QueueProcessorData
-{
-    PluginRequestProcessor *processor;
-    bool stopRequested;
-};
-
 static QueueProcessorData queue_processor_data1 = { NULL, false };
 static QueueProcessorData queue_processor_data2 = { NULL, false };
@@ -314,4 +308,9 @@
             }
       }
+#ifdef __OS2___
+      custom_jre = icedtea_web_jre_dir();
+      if (custom_jre.length())
+          return custom_jre+"/bin/java";
+#endif
       return appletviewer_default_executable;      
 }
@@ -327,5 +326,10 @@
             }
       }
-      return appletviewer_default_rtjar;      
+#ifdef __OS2___
+      custom_jre = icedtea_web_jre_dir();
+      if (custom_jre.length())
+          return custom_jre+"/lib/rt.jar";
+#endif
+      return appletviewer_default_rtjar;
 }
 
@@ -513,5 +517,5 @@
   if (socketpair (AF_LOCAL, SOCK_STREAM, 0, in_pipe) == -1)
     {
-      PLUGIN_ERROR_TWO ("Failed to create input pipe", strerror (errno));
+      PLUGIN_ERROR ("Failed to create input pipe", strerror (errno));
       np_error = NPERR_GENERIC_ERROR;
       goto cleanup_in_pipe;
@@ -550,5 +554,5 @@
   if (socketpair (AF_LOCAL, SOCK_STREAM, 0, out_pipe) == -1)
     {
-      PLUGIN_ERROR_TWO ("Failed to create output pipe", strerror (errno));
+      PLUGIN_ERROR ("Failed to create output pipe", strerror (errno));
       np_error = NPERR_GENERIC_ERROR;
       goto cleanup_out_pipe;
@@ -1594,5 +1598,18 @@
   }
 
+#ifdef __OS2__
+  {
+    std::string path = PLUGIN_BOOTCLASSPATH;
+    static const std::string datadir = "@DATADIR@";
+    size_t pos = 0;
+    while ((pos = path.find(datadir, pos)) != std::string::npos) {
+      path.replace(pos, datadir.length(), icedtea_web_data_dir());
+      pos += datadir.length();
+    }
+    command_line.push_back(path);
+  }
+#else
   command_line.push_back(PLUGIN_BOOTCLASSPATH);
+#endif
   // set the classpath to avoid using the default (cwd).
   command_line.push_back("-classpath");
@@ -1617,6 +1634,6 @@
   command_line.push_back("sun.applet.PluginMain");
 #ifdef __OS2__
-  command_line.push_back((std::ostrstream() << out_pipe[1]).str());
-  command_line.push_back((std::ostrstream() << in_pipe[1]).str());
+  command_line.push_back(static_cast<std::ostringstream &>(std::ostringstream() << out_pipe[1]).str());
+  command_line.push_back(static_cast<std::ostringstream &>(std::ostringstream() << in_pipe[1]).str());
 #else
   command_line.push_back(out_pipe_name);
@@ -2443,9 +2460,9 @@
 
 #ifdef __OS2__
-  // pthread_cancel() isn't implemented on OS?2, so use an old good flag
+  // pthread_cancel() isn't implemented on OS/2, so use an old good flag
   queue_processor_data1.stopRequested = true;
   queue_processor_data2.stopRequested = true;
   queue_processor_data3.stopRequested = true;
-  pthread_cond_broadcast(&cond_message_available);
+  plugin_req_proc->cancelWait();
 #else
   pthread_cancel(plugin_request_processor_thread1);
Index: /trunk/icedtea-web/plugin/icedteanp/IcedTeaNPPlugin.h
===================================================================
--- /trunk/icedtea-web/plugin/icedteanp/IcedTeaNPPlugin.h	(revision 430)
+++ /trunk/icedtea-web/plugin/icedteanp/IcedTeaNPPlugin.h	(revision 431)
@@ -107,4 +107,12 @@
 NPError start_jvm_if_needed();
 
+#ifdef __OS2__
+struct QueueProcessorData
+{
+    PluginRequestProcessor *processor;
+    bool stopRequested;
+};
+#endif
+
 // ID of plug-in thread
 extern pthread_t itnp_plugin_thread_id;
Index: /trunk/icedtea-web/plugin/icedteanp/IcedTeaPluginRequestProcessor.cc
===================================================================
--- /trunk/icedtea-web/plugin/icedteanp/IcedTeaPluginRequestProcessor.cc	(revision 430)
+++ /trunk/icedtea-web/plugin/icedteanp/IcedTeaPluginRequestProcessor.cc	(revision 431)
@@ -643,13 +643,18 @@
     QueueProcessorData *queue_processor_data = (QueueProcessorData *) data;
     PluginRequestProcessor* processor = queue_processor_data->processor;
+    processor->queueProcessorThread(queue_processor_data);
 #else
     PluginRequestProcessor* processor = (PluginRequestProcessor*) data;
+    processor->queueProcessorThread();
 #endif
-    processor->queueProcessorThread();
     return NULL;
 }
 
 void
+#ifdef __OS2__
+PluginRequestProcessor::queueProcessorThread(QueueProcessorData *queue_processor_data)
+#else
 PluginRequestProcessor::queueProcessorThread()
+#endif
 {
     std::vector<std::string*>* message_parts = NULL;
Index: /trunk/icedtea-web/plugin/icedteanp/IcedTeaPluginRequestProcessor.h
===================================================================
--- /trunk/icedtea-web/plugin/icedteanp/IcedTeaPluginRequestProcessor.h	(revision 430)
+++ /trunk/icedtea-web/plugin/icedteanp/IcedTeaPluginRequestProcessor.h	(revision 431)
@@ -70,4 +70,8 @@
 void* queue_processor(void* data);
 
+#ifdef __OS2__
+struct QueueProcessorData;
+#endif
+
 /**
  * Processes requests made TO the plugin (by java or anyone else)
@@ -127,5 +131,10 @@
 
         /* Thread run method for processing queued messages */
+#ifdef __OS2__
+        void queueProcessorThread(QueueProcessorData *queue_processor_data);
+        void cancelWait() { pthread_cond_broadcast(&cond_message_available); }
+#else
         void queueProcessorThread();
+#endif
 };
 
Index: /trunk/icedtea-web/plugin/icedteanp/Makefile.kmk
===================================================================
--- /trunk/icedtea-web/plugin/icedteanp/Makefile.kmk	(revision 430)
+++ /trunk/icedtea-web/plugin/icedteanp/Makefile.kmk	(revision 431)
@@ -38,5 +38,6 @@
     IcedTeaJavaRequestProcessor.cc \
     IcedTeaPluginRequestProcessor.cc \
-    IcedTeaPluginUtils.cc
+    IcedTeaPluginUtils.cc \
+    IcedTeaParseProperties.cc
 
 npicedt_SOURCES.os2 = \
Index: /trunk/icedtea-web/plugin/icedteanp/java/sun/applet/PluginMain.java
===================================================================
--- /trunk/icedtea-web/plugin/icedteanp/java/sun/applet/PluginMain.java	(revision 430)
+++ /trunk/icedtea-web/plugin/icedteanp/java/sun/applet/PluginMain.java	(revision 431)
@@ -133,12 +133,5 @@
             JNLPRuntime.exit(1);
         }
-        DeploymentConfiguration.move14AndOlderFilesTo15StructureCatched();
-        if (JavaConsole.isEnabled()) {
-            if ((args.length < 3) || !new File(args[2]).exists()) {
-                OutputController.getLogger().log(OutputController.Level.ERROR_ALL, "Warning, although console is on, plugin debug connection do not exists. No plugin information will be displayed in console (only java ones).");
-            } else {
-                JavaConsole.getConsole().createPluginReader(new File(args[2]));
-            }
-        }
+
         try {
             PluginStreamHandler streamHandler = connect(args);
Index: /trunk/icedtea-web/plugin/icedteanp/os2/OS_OS2_WinOS2.cc
===================================================================
--- /trunk/icedtea-web/plugin/icedteanp/os2/OS_OS2_WinOS2.cc	(revision 430)
+++ /trunk/icedtea-web/plugin/icedteanp/os2/OS_OS2_WinOS2.cc	(revision 431)
@@ -41,4 +41,5 @@
 #include <winuser32.h> // CreateFakeWindowEx and friends
 
+#include "IcedTeaNPPlugin.h"
 #include "IcedTeaPluginUtils.h"
 
Index: /trunk/icedtea-web/plugin/icedteanp/os2/java/sun/applet/PluginMainBase.java
===================================================================
--- /trunk/icedtea-web/plugin/icedteanp/os2/java/sun/applet/PluginMainBase.java	(revision 430)
+++ /trunk/icedtea-web/plugin/icedteanp/os2/java/sun/applet/PluginMainBase.java	(revision 431)
@@ -44,4 +44,8 @@
 import java.io.IOException;
 
+import net.sourceforge.jnlp.config.DeploymentConfiguration;
+import net.sourceforge.jnlp.util.logging.JavaConsole;
+import net.sourceforge.jnlp.util.logging.OutputController;
+
 class PluginMainBase {
 
@@ -50,11 +54,20 @@
 
     static boolean checkArgs(String args[]) {
-        if (args.length == 2) {
+        if (args.length >= 2) {
             inPipe = Integer.valueOf(args[0]).intValue();
             outPipe = Integer.valueOf(args[1]).intValue();
-            if (inPipe >= 0 && outPipe >= 0)
+            if (inPipe >= 0 && outPipe >= 0) {
+                DeploymentConfiguration.move14AndOlderFilesTo15StructureCatched();
+                if (JavaConsole.isEnabled()) {
+                    if ((args.length < 3) || !new File(args[2]).exists()) {
+                        OutputController.getLogger().log(OutputController.Level.ERROR_ALL, "Warning, although console is on, plugin debug connection do not exists. No plugin information will be displayed in console (only java ones).");
+                    } else {
+                        JavaConsole.getConsole().createPluginReader(new File(args[2]));
+                    }
+                }
                 return true;
+            }
         }
-        System.err.println("Invalid pipe descriptors provided. Refusing to proceed.");
+        OutputController.getLogger().log(OutputController.Level.ERROR_ALL, "Invalid pipe descriptors provided. Refusing to proceed.");
         return false;
     }
@@ -67,10 +80,6 @@
         FileDescriptor outPipeFD = new FileDescriptor();
         fdAccess.set(outPipeFD, outPipe);
-        try {
-            streamHandler = new PluginStreamHandler(new FileInputStream(inPipeFD), new FileOutputStream(outPipeFD));
-            PluginDebug.debug("Streams initialized");
-        } catch (IOException ioe) {
-            ioe.printStackTrace();
-        }
+        streamHandler = new PluginStreamHandler(new FileInputStream(inPipeFD), new FileOutputStream(outPipeFD));
+        PluginDebug.debug("Streams initialized");
         return streamHandler;
     }
Index: /trunk/icedtea-web/plugin/icedteanp/x11/java/sun/applet/PluginMainBase.java
===================================================================
--- /trunk/icedtea-web/plugin/icedteanp/x11/java/sun/applet/PluginMainBase.java	(revision 430)
+++ /trunk/icedtea-web/plugin/icedteanp/x11/java/sun/applet/PluginMainBase.java	(revision 431)
@@ -46,7 +46,15 @@
 
     static boolean checkArgs(String args[]) {
-        if (args.length != 2 || !(new File(args[0]).exists()) || !(new File(args[1]).exists())) {
-            System.err.println("Invalid pipe names provided. Refusing to proceed.");
+        if (args.length < 2 || !(new File(args[0]).exists()) || !(new File(args[1]).exists())) {
+            OutputController.getLogger().log(OutputController.Level.ERROR_ALL, "Invalid pipe names provided. Refusing to proceed.");
             return false;
+        }
+        DeploymentConfiguration.move14AndOlderFilesTo15StructureCatched();
+        if (JavaConsole.isEnabled()) {
+            if ((args.length < 3) || !new File(args[2]).exists()) {
+                OutputController.getLogger().log(OutputController.Level.ERROR_ALL, "Warning, although console is on, plugin debug connection do not exists. No plugin information will be displayed in console (only java ones).");
+            } else {
+                JavaConsole.getConsole().createPluginReader(new File(args[2]));
+            }
         }
         return true;
@@ -61,5 +69,5 @@
             PluginDebug.debug("Streams initialized");
         } catch (IOException ioe) {
-            ioe.printStackTrace();
+            OutputController.getLogger().log(OutputController.Level.ERROR_ALL,ioe);
         }
         return streamHandler;
