Index: /trunk/icedtea-web/Config.kmk
===================================================================
--- /trunk/icedtea-web/Config.kmk	(revision 356)
+++ /trunk/icedtea-web/Config.kmk	(revision 357)
@@ -16,12 +16,16 @@
 IT_LANGUAGE_SOURCE_VERSION := 6
 IT_CLASS_TARGET_VERSION    := 6
-IT_JAVAC_SETTINGS           = -g -encoding utf-8 $(JAVACFLAGS) $(MEMORY_LIMIT) $(PREFER_SOURCE)
-IT_JAVACFLAGS               = $(IT_JAVAC_SETTINGS) -source $(IT_LANGUAGE_SOURCE_VERSION) -target $(IT_CLASS_TARGET_VERSION)
+IT_JAVAC_SETTINGS          ?= -g -encoding utf-8 $(JAVACFLAGS) $(MEMORY_LIMIT) $(PREFER_SOURCE)
+IT_JAVACFLAGS              ?= $(IT_JAVAC_SETTINGS) -source $(IT_LANGUAGE_SOURCE_VERSION) -target $(IT_CLASS_TARGET_VERSION)
 
-BOOTSTRAP_JDK_RUNTIME   = $(PATH_BOOTSTRAP_JDK)/jre/lib/rt.jar;$(PATH_BOOTSTRAP_JDK)/jre/lib/jsse.jar
+BOOTSTRAP_JDK_RUNTIME  ?= $(PATH_BOOTSTRAP_JDK)/jre/lib/rt.jar;$(PATH_BOOTSTRAP_JDK)/jre/lib/jsse.jar
 
-NETX_RESOURCE_DIR       = $(PATH_ROOT)/netx/net/sourceforge/jnlp/resources
+INSTALL_DATA       := install -m 644
 
-INSTALL_DATA       := $(INSTALL) -m 644
+# @todo later
+ICEDTEA_WEB_JRE_DIR     := /@unixroot/usr/lib/jre
+ICEDTEA_WEB_DATA_DIR    := /@unixroot/usr/share/$(PACKAGE_NAME)
+
+ICEDTEA_WEB_JRE     = icedtea_web_jre_dir()
 
 #
@@ -32,6 +36,8 @@
 #  - we want full privileges
 #
-LAUNCHER_BOOTCLASSPATH  = -Xbootclasspath/a:$(datadir)/$(PACKAGE_NAME)/netx.jar$(RHINO_RUNTIME)
-PLUGIN_BOOTCLASSPATH    = -Xbootclasspath/a:$(datadir)/$(PACKAGE_NAME)/netx.jar;$(datadir)/$(PACKAGE_NAME)/plugin.jar$(RHINO_RUNTIME)
+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()
 
 # Fake update version to work with the Deployment Toolkit script used by Oracle
@@ -86,5 +92,5 @@
 MOZILLA_VERSION_COLLAPSED  ?= 11000000 # 11.0.0.0
 
-PATH_GLIB_INCS             ?= $(patsubst -I%,%,$(shell pkg-config --cflags-only-I glib-2.0))
-PATH_GLIB_LIBS             ?= $(patsubst -l%,%,$(shell pkg-config --libs-only-l glib-2.0))
-PATH_GLIB_LIBPATH          ?= $(patsubst -L%,%,$(shell pkg-config --libs-only-L glib-2.0))
+PATH_GLIB_INCS             ?= $(patsubst -I%,%,$(shell pkg-config --cflags-only-I glib-2.0 gthread-2.0))
+PATH_GLIB_LIBS             ?= $(patsubst -l%,%,$(shell pkg-config --libs-only-l glib-2.0 gthread-2.0))
+PATH_GLIB_LIBPATH          ?= $(patsubst -L%,%,$(shell pkg-config --libs-only-L glib-2.0 gthread-2.0))
Index: /trunk/icedtea-web/extra/OS.cc
===================================================================
--- /trunk/icedtea-web/extra/OS.cc	(revision 357)
+++ /trunk/icedtea-web/extra/OS.cc	(revision 357)
@@ -0,0 +1,61 @@
+/* OS.cc
+
+   Copyright (C) 2009, 2010  Red Hat
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+IcedTea is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <stdlib.h>
+
+#include "OS.h"
+
+#ifdef __OS2__
+
+const char *icedtea_web_data_dir()
+{
+  const char *home = getenv("ICEDTEA_WEB_DATA");
+  if (!home)
+    home = ICEDTEA_WEB_DATA_DIR;
+  return home;
+}
+
+const char *icedtea_web_jre_dir()
+{
+  const char *jre = getenv("ICEDTEA_WEB_JRE");
+  if (!jre)
+    jre = ICEDTEA_WEB_JRE_DIR;
+  return jre;
+}
+
+#endif // __OS2__
Index: /trunk/icedtea-web/extra/OS.h
===================================================================
--- /trunk/icedtea-web/extra/OS.h	(revision 357)
+++ /trunk/icedtea-web/extra/OS.h	(revision 357)
@@ -0,0 +1,47 @@
+/* OS.h
+
+   Copyright (C) 2009, 2010  Red Hat
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+IcedTea is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#ifndef __OS_H__
+#define __OS_H__
+
+#ifdef __OS2__
+const char *icedtea_web_data_dir();
+const char *icedtea_web_jre_dir();
+#endif
+
+#endif // __OS_H__
Index: /trunk/icedtea-web/plugin/icedteanp/IcedTeaJavaRequestProcessor.cc
===================================================================
--- /trunk/icedtea-web/plugin/icedteanp/IcedTeaJavaRequestProcessor.cc	(revision 356)
+++ /trunk/icedtea-web/plugin/icedteanp/IcedTeaJavaRequestProcessor.cc	(revision 357)
@@ -36,4 +36,8 @@
 obligated to do so.  If you do not wish to do so, delete this
 exception statement from your version. */
+
+#ifdef __EMX__
+#include <unistd.h> // usleep
+#endif
 
 #include <typeinfo>
Index: /trunk/icedtea-web/plugin/icedteanp/IcedTeaNPPlugin.cc
===================================================================
--- /trunk/icedtea-web/plugin/icedteanp/IcedTeaNPPlugin.cc	(revision 356)
+++ /trunk/icedtea-web/plugin/icedteanp/IcedTeaNPPlugin.cc	(revision 357)
@@ -37,4 +37,10 @@
 exception statement from your version. */
 
+#ifdef __OS2__
+// OS/2 includes.
+#define INCL_PM
+#include <os2.h>
+#endif
+
 // System includes.
 #include <dlfcn.h>
@@ -51,4 +57,6 @@
 #include "IcedTeaScriptablePluginObject.h"
 #include "IcedTeaNPPlugin.h"
+
+#include "OS.h"
 
 #if MOZILLA_VERSION_COLLAPSED < 1090100
@@ -1079,4 +1087,14 @@
 plugin_display_failure_dialog ()
 {
+#ifdef __OS2__
+  gchar *msg = NULL;
+
+  PLUGIN_DEBUG ("plugin_display_failure_dialog\n");
+
+  msg = g_strdup_printf (FAILURE_MESSAGE, appletviewer_executable);
+  WinMessageBox (HWND_DESKTOP, HWND_DESKTOP,
+                 msg, "Error", 0, MB_ERROR | MB_OK);
+  g_free(msg);
+#else
   GtkWidget* dialog = NULL;
 
@@ -1092,4 +1110,5 @@
   gtk_dialog_run (GTK_DIALOG (dialog));
   gtk_widget_destroy (dialog);
+#endif
 
   PLUGIN_DEBUG ("plugin_display_failure_dialog return\n");
@@ -1534,5 +1553,5 @@
       command_line = (gchar**) malloc(sizeof(gchar*)*11);
       command_line[cmd_num++] = g_strdup(appletviewer_executable);
-      command_line[cmd_num++] = g_strdup(PLUGIN_BOOTCLASSPATH);
+      command_line[cmd_num++] = g_strdup_printf(PLUGIN_BOOTCLASSPATH);
       // set the classpath to avoid using the default (cwd).
       command_line[cmd_num++] = g_strdup("-classpath");
@@ -1555,5 +1574,5 @@
       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_printf(PLUGIN_BOOTCLASSPATH);
       command_line[cmd_num++] = g_strdup("-classpath");
       command_line[cmd_num++] = g_strdup_printf("%s/lib/rt.jar", ICEDTEA_WEB_JRE);
@@ -2263,5 +2282,5 @@
 // Returns a string describing the MIME type that this plugin
 // handles.
-char*
+const char*
 NP_GetMIMEDescription ()
 {
@@ -2270,5 +2289,5 @@
   PLUGIN_DEBUG ("NP_GetMIMEDescription return\n");
 
-  return (char*) PLUGIN_MIME_DESC;
+  return PLUGIN_MIME_DESC;
 }
 
Index: /trunk/icedtea-web/plugin/icedteanp/IcedTeaNPPlugin.h
===================================================================
--- /trunk/icedtea-web/plugin/icedteanp/IcedTeaNPPlugin.h	(revision 356)
+++ /trunk/icedtea-web/plugin/icedteanp/IcedTeaNPPlugin.h	(revision 357)
@@ -52,6 +52,8 @@
 #include <glib/gstdio.h>
 
+#ifndef __OS2__
 // GTK includes.
 #include <gtk/gtk.h>
+#endif
 
 #include "IcedTeaPluginUtils.h"
Index: /trunk/icedtea-web/plugin/icedteanp/IcedTeaPluginUtils.cc
===================================================================
--- /trunk/icedtea-web/plugin/icedteanp/IcedTeaPluginUtils.cc	(revision 356)
+++ /trunk/icedtea-web/plugin/icedteanp/IcedTeaPluginUtils.cc	(revision 357)
@@ -36,4 +36,8 @@
 obligated to do so.  If you do not wish to do so, delete this
 exception statement from your version. */
+
+#ifdef __EMX__
+#include <unistd.h> // usleep
+#endif
 
 #include "IcedTeaNPPlugin.h"
Index: /trunk/icedtea-web/plugin/icedteanp/Makefile.kmk
===================================================================
--- /trunk/icedtea-web/plugin/icedteanp/Makefile.kmk	(revision 356)
+++ /trunk/icedtea-web/plugin/icedteanp/Makefile.kmk	(revision 357)
@@ -7,13 +7,18 @@
 DLLS               += npicedt
 npicedt_TEMPLATE    = Cxx
-npicedt_INCS        = $(PATH_MOZILLA_INCS) $(PATH_GLIB_INCS)
-npicedt_DEFS        = JDK_UPDATE_VERSION=$(JDK_UPDATE_VERSION) \
-                      MOZILLA_VERSION_COLLAPSED=$(MOZILLA_VERSION_COLLAPSED)
-npicedt_CXXFLAGS    = -DPLUGIN_NAME="IcedTea-Web Plugin" \
-                      -DPLUGIN_VERSION="IcedTea-Web $(FULL_VERSION)" \
-                      -DPACKAGE_URL="$(PACKAGE_URL)" \
-                      -DICEDTEA_WEB_JRE="$(SYSTEM_JRE_DIR)" \
+npicedt_INCS        = $(PATH_ROOT)/extra $(PATH_MOZILLA_INCS) $(PATH_GLIB_INCS)
+npicedt_DEFS        = MOZILLA_VERSION_COLLAPSED=$(MOZILLA_VERSION_COLLAPSED) \
+                      DETECT_DATA_DIR=$(DETECT_DATA_DIR) \
+                      DETECT_JRE_DIR=$(DETECT_JRE_DIR) \
+                      WITHOUT_GTK
+npicedt_CXXFLAGS    = -DJDK_UPDATE_VERSION="\"$(JDK_UPDATE_VERSION)\"" \
+                      -DPLUGIN_NAME="\"IcedTea-Web Plugin\"" \
+                      -DPLUGIN_VERSION="\"IcedTea-Web $(FULL_VERSION)\"" \
+                      -DPACKAGE_URL="\"$(PACKAGE_URL)\"" \
+                      -DICEDTEA_WEB_JRE_DIR="\"$(SYSTEM_JRE_DIR)\"" \
+                      -DICEDTEA_WEB_JRE="$(ICEDTEA_WEB_JRE)" \
+                      -DICEDTEA_WEB_DATA_DIR="\"$(ICEDTEA_WEB_DATA_DIR)\"" \
                       -DPLUGIN_BOOTCLASSPATH="$(PLUGIN_BOOTCLASSPATH)"
-npicedt_LIBS        = $(PATH_GLIB_LIBS)
+npicedt_LIBS        = $(PATH_GLIB_LIBS) pthread
 npicedt_LIBPATH     = $(PATH_GLIB_LIBPATH)
 
@@ -23,5 +28,6 @@
     IcedTeaJavaRequestProcessor.cc \
     IcedTeaPluginRequestProcessor.cc \
-    IcedTeaPluginUtils.cc
+    IcedTeaPluginUtils.cc \
+    $(PATH_ROOT)/extra/OS.cc
 
 # Unsorted stuff from Makefile.in
