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 19:09:50 UTC

cvs commit: jakarta-tomcat/src/share/org/apache/jasper/compiler JikesJavaCompiler.java

pierred     00/09/01 10:09:50

  Modified:    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.6       +32 -9     jakarta-tomcat/src/share/org/apache/jasper/compiler/JikesJavaCompiler.java
  
  Index: JikesJavaCompiler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/JikesJavaCompiler.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- JikesJavaCompiler.java	2000/06/15 00:26:43	1.5
  +++ JikesJavaCompiler.java	2000/09/01 17:09:49	1.6
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/JikesJavaCompiler.java,v 1.5 2000/06/15 00:26:43 costin Exp $
  - * $Revision: 1.5 $
  - * $Date: 2000/06/15 00:26:43 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/JikesJavaCompiler.java,v 1.6 2000/09/01 17:09:49 pierred Exp $
  + * $Revision: 1.6 $
  + * $Date: 2000/09/01 17:09:49 $
    *
    * ====================================================================
    *
  @@ -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);