You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by pi...@locus.apache.org on 2000/09/01 17:58:49 UTC
cvs commit: jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler JikesJavaCompiler.java
pierred 00/09/01 08:58:46
Modified: jasper/src/share/org/apache/jasper/compiler
JikesJavaCompiler.java
Log:
Changed to work with Microsoft VM (needs to include in classpath
contents of System.getProperty("java.home")\Packages\*.zip )
Submitted by: Marc Beneteau (mbeneteau2@home.com)
Revision Changes Path
1.2 +32 -9 jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/JikesJavaCompiler.java
Index: JikesJavaCompiler.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/JikesJavaCompiler.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- JikesJavaCompiler.java 2000/08/12 00:52:08 1.1
+++ JikesJavaCompiler.java 2000/09/01 15:58:44 1.2
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/JikesJavaCompiler.java,v 1.1 2000/08/12 00:52:08 pierred Exp $
- * $Revision: 1.1 $
- * $Date: 2000/08/12 00:52:08 $
+ * $Header: /home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/JikesJavaCompiler.java,v 1.2 2000/09/01 15:58:44 pierred Exp $
+ * $Revision: 1.2 $
+ * $Date: 2000/09/01 15:58:44 $
*
* ====================================================================
*
@@ -78,6 +78,14 @@
static final int OUTPUT_BUFFER_SIZE = 1024;
static final int BUFFER_SIZE = 512;
+ /*
+ * Contains extra classpath for Jikes use from Microsoft systems:
+ * Microsoft does not report it's internal classpath in
+ * System.getProperty(java.class.path) which results in jikes to fail.
+ * (Internal classpath with other JVMs contains for instance rt.jar).
+ */
+ static StringBuffer MicrosoftClasspath = null;
+
String encoding;
String classpath;
String compilerPath = "jikes";
@@ -126,15 +134,30 @@
public boolean compile(String source) {
Process p;
int exitValue = -1;
+
+ // Used to dynamically load classpath if using Microsoft
+ // virtual machine
+ if (MicrosoftClasspath==null) {
+ MicrosoftClasspath = new StringBuffer(200);
+ if (System.getProperty("java.vendor").startsWith("Microsoft")) {
+ //Get Microsoft classpath
+ String javaHome = System.getProperty("java.home") +
+ "\\Packages";
+ File libDir=new File(javaHome);
+ String[] zips=libDir.list();
+ for(int i=0;i<zips.length;i++) {
+ MicrosoftClasspath.append(";" + javaHome + "\\" + zips[i]);
+ }
+ }
+ }
- String[] compilerCmd = new String[] {
- compilerPath,
+ String[] compilerCmd = new String[] {
+ "\"" + compilerPath + "\"",
//XXX - add encoding once Jikes supports it
- "-classpath", classpath,
- "-d", outdir,
- // Only report errors, to be able to test on output in addition to exit code
+ "-classpath", "\"" + classpath + MicrosoftClasspath + "\"",
+ "-d", "\"" + outdir + "\"",
"-nowarn",
- source
+ "\"" + source + "\""
};
ByteArrayOutputStream tmpErr = new ByteArrayOutputStream(OUTPUT_BUFFER_SIZE);