Here's a patch to fix the jikes compiler code in Jasper - against tomcat 3.3 m2 It looks like there is something OS specific in the original code. Its not clear to me that my fix would work under all platforms. I'll leave that to greater minds. It looks like under some OS, extra quotes are put around each argument. I don't know what OS would that be - it should fail under every OS I'm familiar with... But that is the only explanation that I have for the extra quotes. Under linux, the original code fails. I imagine it would fail under most other UNIX systems. Hope someone can make some sense of this. Using jikes has been a significant performance improvement for us. The javac compiler has a remarkably high initialization hit - something jikes has successfully minimized. Have Fun, -Tom --- jakarta-tomcat/src/share/org/apache/jasper/compiler/JikesJavaCompiler.java Sun Jan 14 15:45:40 2001 +++ jakarta-tomcat-new/src/share/org/apache/jasper/compiler/JikesJavaCompiler.java + Sat Mar 17 23:20:41 2001 @@ -67,6 +67,7 @@ import java.io.File; import java.io.ByteArrayOutputStream; + /** * A Plug-in class for specifying a 'jikes' compile. * @@ -88,7 +89,7 @@ String encoding; String classpath; - String compilerPath = "jikes"; + String compilerPath = "/usr/local/java/jikes-1.13/bin/jikes"; String outdir; OutputStream out; boolean classDebugInfo=false; @@ -161,26 +162,27 @@ String[] compilerCmd; if (classDebugInfo) { - compilerCmd = new String[] { - "\"" + compilerPath + "\"", - "-g", - //XXX - add encoding once Jikes supports it - "-classpath", "\"" + classpath + MicrosoftClasspath + "\"", - "-d", "\"" + outdir + "\"", - "-nowarn", - "\"" + source + "\"" - }; + compilerCmd = new String[] { + compilerPath, + "-g", + //XXX - add encoding once Jikes supports it + "-classpath", classpath, + "-d", outdir, + "-nowarn", + source + }; } else { - compilerCmd = new String[] { - "\"" + compilerPath + "\"", - //XXX - add encoding once Jikes supports it - "-classpath", "\"" + classpath + MicrosoftClasspath + "\"", - "-d", "\"" + outdir + "\"", - "-nowarn", - "\"" + source + "\"" - }; + compilerCmd = new String[] { + compilerPath, + "-encoding", "UTF8", + "-classpath", classpath, + "-d", outdir, + "-nowarn", + source + }; } + ByteArrayOutputStream tmpErr = new ByteArrayOutputStream(OUTPUT_BUFFER_SIZE); try { p = Runtime.getRuntime().exec(compilerCmd); @@ -198,7 +200,6 @@ // Wait until the complete error stream has been read errPumper.join(); compilerErr.close(); - p.destroy(); // Write the compiler error messages, if any, to the real stream @@ -218,6 +219,7 @@ if (tmpErr.size() > 0) { isOkay = false; } + return isOkay; }
--- jakarta-tomcat/src/share/org/apache/jasper/compiler/JikesJavaCompiler.java Sun Jan 14 15:45:40 2001 +++ jakarta-tomcat-new/src/share/org/apache/jasper/compiler/JikesJavaCompiler.java + Sat Mar 17 23:20:41 2001 @@ -67,6 +67,7 @@ import java.io.File; import java.io.ByteArrayOutputStream; + /** * A Plug-in class for specifying a 'jikes' compile. * @@ -88,7 +89,7 @@ String encoding; String classpath; - String compilerPath = "jikes"; + String compilerPath = "/usr/local/java/jikes-1.13/bin/jikes"; String outdir; OutputStream out; boolean classDebugInfo=false; @@ -161,26 +162,27 @@ String[] compilerCmd; if (classDebugInfo) { - compilerCmd = new String[] { - "\"" + compilerPath + "\"", - "-g", - //XXX - add encoding once Jikes supports it - "-classpath", "\"" + classpath + MicrosoftClasspath + "\"", - "-d", "\"" + outdir + "\"", - "-nowarn", - "\"" + source + "\"" - }; + compilerCmd = new String[] { + compilerPath, + "-g", + //XXX - add encoding once Jikes supports it + "-classpath", classpath, + "-d", outdir, + "-nowarn", + source + }; } else { - compilerCmd = new String[] { - "\"" + compilerPath + "\"", - //XXX - add encoding once Jikes supports it - "-classpath", "\"" + classpath + MicrosoftClasspath + "\"", - "-d", "\"" + outdir + "\"", - "-nowarn", - "\"" + source + "\"" - }; + compilerCmd = new String[] { + compilerPath, + "-encoding", "UTF8", + "-classpath", classpath, + "-d", outdir, + "-nowarn", + source + }; } + ByteArrayOutputStream tmpErr = new ByteArrayOutputStream(OUTPUT_BUFFER_SIZE); try { p = Runtime.getRuntime().exec(compilerCmd); @@ -198,7 +200,6 @@ // Wait until the complete error stream has been read errPumper.join(); compilerErr.close(); - p.destroy(); // Write the compiler error messages, if any, to the real stream @@ -218,6 +219,7 @@ if (tmpErr.size() > 0) { isOkay = false; } + return isOkay; }