You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by ap...@apache.org on 2007/07/12 10:23:00 UTC

svn commit: r555529 - in /harmony/enhanced/jdktools/trunk/modules/samsa: build.xml src/main/native/samsa/samsa.c

Author: apetrenko
Date: Thu Jul 12 01:22:58 2007
New Revision: 555529

URL: http://svn.apache.org/viewvc?view=rev&rev=555529
Log:
Patch for HARMONY-4420 "[build][Tomcat 6] jdk\bin does not have javaw executable"

Modified:
    harmony/enhanced/jdktools/trunk/modules/samsa/build.xml
    harmony/enhanced/jdktools/trunk/modules/samsa/src/main/native/samsa/samsa.c

Modified: harmony/enhanced/jdktools/trunk/modules/samsa/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/samsa/build.xml?view=diff&rev=555529&r1=555528&r2=555529
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/samsa/build.xml (original)
+++ harmony/enhanced/jdktools/trunk/modules/samsa/build.xml Thu Jul 12 01:22:58 2007
@@ -69,6 +69,9 @@
         <copy file="${hy.samsa.exe}" tofile="${hy.jdk}/bin/java${exe.suffix}" />
         <chmod file="${hy.jdk}/bin/java${exe.suffix}" perm="ugo+x" />
 
+        <copy file="${hy.samsa.exe}" tofile="${hy.jdk}/bin/javaw${exe.suffix}" />
+        <chmod file="${hy.jdk}/bin/java${exe.suffix}" perm="ugo+x" />
+
         <copy file="${hy.samsa.exe}" tofile="${hy.jdk}/bin/keytool${exe.suffix}" />
         <chmod file="${hy.jdk}/bin/keytool${exe.suffix}" perm="ugo+x" />
 

Modified: harmony/enhanced/jdktools/trunk/modules/samsa/src/main/native/samsa/samsa.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/samsa/src/main/native/samsa/samsa.c?view=diff&rev=555529&r1=555528&r2=555529
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/samsa/src/main/native/samsa/samsa.c (original)
+++ harmony/enhanced/jdktools/trunk/modules/samsa/src/main/native/samsa/samsa.c Thu Jul 12 01:22:58 2007
@@ -33,6 +33,7 @@
 #define PATH_SEPARATOR_CHAR '/'
 #define PATH_SEPARATOR      "/"
 #define EXE_POSTFIX         "/jre/bin/java"
+#define WEXE_POSTFIX        "/jre/bin/javaw"
 #define LIB_POSTFIX         "/lib/"
 #define CLASSPATH_SEP       ":"
 #endif
@@ -41,6 +42,7 @@
 #define PATH_SEPARATOR_CHAR '\\'
 #define PATH_SEPARATOR      "\\"
 #define EXE_POSTFIX         "\\jre\\bin\\java.exe"
+#define WEXE_POSTFIX        "\\jre\\bin\\javaw.exe"
 #define LIB_POSTFIX         "\\lib\\"
 #define CLASSPATH_SEP       ";"
 #endif
@@ -90,6 +92,8 @@
     char *jdkRoot = NULL;
     char *fullExePath = NULL;
     TOOLDATA *pToolData = (TOOLDATA *) malloc(sizeof(TOOLDATA));
+    
+    int isJavaw = 0;
 
     /*
      *  get the jdkroot and the construct invocation path for exe
@@ -116,6 +120,8 @@
         fprintf(stderr, "Uknown tool name %s\n", argv[0]);
         return 1;
     }
+    
+    isJavaw = strcmp(toolName, "javaw") == 0;
 
     /*
      *  get the 'tool data' - right now, this is just the jars
@@ -131,7 +137,15 @@
     fullExePath = (char *) malloc(strlen(jdkRoot) + strlen(EXE_POSTFIX) + 1);
     
     strcpy(fullExePath, jdkRoot);
-    strcat(fullExePath, EXE_POSTFIX);
+    
+    /* 
+     * If we're javaw then we need to javaw to command line
+     */
+    if (isJavaw) {
+        strcat(fullExePath, WEXE_POSTFIX);
+    } else {
+        strcat(fullExePath, EXE_POSTFIX);
+    }
     
     /*
      *  we're invoking java with the following 
@@ -140,9 +154,9 @@
     myArgv[newIndex++] = fullExePath;
     
     /*
-     *  if we're not java, put the tools on cp, figure out the tool class to invoke...
+     *  if we're not java or javaw, put the tools on cp, figure out the tool class to invoke...
      */
-    if (strcmp(toolName, "java")) {
+    if (strcmp(toolName, "java") && !isJavaw) {
         char *classpath;
         char *buffer;
 
@@ -279,7 +293,7 @@
     free(cmd_line);
 
     // wait for child process to finish
-    if (WAIT_FAILED == WaitForSingleObject(procInfo.hProcess, INFINITE)) {
+    if (!isJavaw && WAIT_FAILED == WaitForSingleObject(procInfo.hProcess, INFINITE)) {
 
         fprintf(stderr, "Error waiting for process : %d\n", GetLastError());