git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@269845 13f79535-47bb-0310-9956-ffa450edef68master
@@ -68,6 +68,7 @@ import java.io.File; | |||||
import java.io.PrintWriter; | import java.io.PrintWriter; | ||||
import java.io.FileWriter; | import java.io.FileWriter; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.util.Locale; | |||||
import java.util.Random; | import java.util.Random; | ||||
/** | /** | ||||
@@ -165,48 +166,7 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { | |||||
} | } | ||||
if (includeJavaRuntime) { | if (includeJavaRuntime) { | ||||
// XXX move this stuff to a separate class, code is identical to | |||||
// code in ../rmic/DefaultRmicAdapter | |||||
if (System.getProperty("java.vendor").toLowerCase().indexOf("microsoft") >= 0) { | |||||
// Pull in *.zip from packages directory | |||||
FileSet msZipFiles = new FileSet(); | |||||
msZipFiles.setDir(new File(System.getProperty("java.home") + File.separator + "Packages")); | |||||
msZipFiles.setIncludes("*.ZIP"); | |||||
classpath.addFileset(msZipFiles); | |||||
} | |||||
else if (Project.getJavaVersion() == Project.JAVA_1_1) { | |||||
classpath.addExisting(new Path(null, | |||||
System.getProperty("java.home") | |||||
+ File.separator + "lib" | |||||
+ File.separator | |||||
+ "classes.zip")); | |||||
} else { | |||||
// JDK > 1.1 seems to set java.home to the JRE directory. | |||||
classpath.addExisting(new Path(null, | |||||
System.getProperty("java.home") | |||||
+ File.separator + "lib" | |||||
+ File.separator + "rt.jar")); | |||||
// Just keep the old version as well and let addExistingToPath | |||||
// sort it out. | |||||
classpath.addExisting(new Path(null, | |||||
System.getProperty("java.home") | |||||
+ File.separator +"jre" | |||||
+ File.separator + "lib" | |||||
+ File.separator + "rt.jar")); | |||||
// Added for MacOS X | |||||
classpath.addExisting(new Path(null, | |||||
System.getProperty("java.home") | |||||
+ File.separator + ".." | |||||
+ File.separator + "Classes" | |||||
+ File.separator + "classes.jar")); | |||||
classpath.addExisting(new Path(null, | |||||
System.getProperty("java.home") | |||||
+ File.separator + ".." | |||||
+ File.separator + "Classes" | |||||
+ File.separator + "ui.jar")); | |||||
} | |||||
classpath.addJavaRuntime(); | |||||
} | } | ||||
return classpath; | return classpath; | ||||
@@ -145,55 +145,7 @@ public abstract class DefaultRmicAdapter implements RmicAdapter { | |||||
} | } | ||||
if (attributes.getIncludejavaruntime()) { | if (attributes.getIncludejavaruntime()) { | ||||
// XXX move this stuff to a separate class, code is identical to | |||||
// code in ../compiler/DefaultCompilerAdapter | |||||
if (System.getProperty("java.vendor").toLowerCase().indexOf("microsoft") >= 0) { | |||||
// Pull in *.zip from packages directory | |||||
FileSet msZipFiles = new FileSet(); | |||||
msZipFiles.setDir(new File(System.getProperty("java.home") + File.separator + "Packages")); | |||||
msZipFiles.setIncludes("*.ZIP"); | |||||
classpath.addFileset(msZipFiles); | |||||
} else if (Project.getJavaVersion() == Project.JAVA_1_1) { | |||||
classpath.addExisting(new Path(null, | |||||
System.getProperty("java.home") | |||||
+ File.separator + "lib" | |||||
+ File.separator | |||||
+ "classes.zip")); | |||||
} else if(System.getProperty("java.vm.name").equals("Kaffe")) { | |||||
FileSet kaffeJarFiles = new FileSet(); | |||||
kaffeJarFiles.setDir(new File(System.getProperty("java.home") | |||||
+ File.separator + "share" | |||||
+ File.separator + "kaffe")); | |||||
kaffeJarFiles.setIncludes("*.jar"); | |||||
classpath.addFileset(kaffeJarFiles); | |||||
} else { | |||||
// JDK > 1.1 seems to set java.home to the JRE directory. | |||||
classpath.addExisting(new Path(null, | |||||
System.getProperty("java.home") | |||||
+ File.separator + "lib" | |||||
+ File.separator + "rt.jar")); | |||||
// Just keep the old version as well and let addExistingToPath | |||||
// sort it out. | |||||
classpath.addExisting(new Path(null, | |||||
System.getProperty("java.home") | |||||
+ File.separator +"jre" | |||||
+ File.separator + "lib" | |||||
+ File.separator + "rt.jar")); | |||||
// Added for MacOS X | |||||
classpath.addExisting(new Path(null, | |||||
System.getProperty("java.home") | |||||
+ File.separator + ".." | |||||
+ File.separator + "Classes" | |||||
+ File.separator + "classes.jar")); | |||||
classpath.addExisting(new Path(null, | |||||
System.getProperty("java.home") | |||||
+ File.separator + ".." | |||||
+ File.separator + "Classes" | |||||
+ File.separator + "ui.jar")); | |||||
} | |||||
classpath.addJavaRuntime(); | |||||
} | } | ||||
return classpath; | return classpath; | ||||
} | } | ||||
@@ -62,7 +62,7 @@ import org.apache.tools.ant.PathTokenizer; | |||||
import java.io.File; | import java.io.File; | ||||
import java.util.Enumeration; | import java.util.Enumeration; | ||||
import java.util.Locale; | |||||
import java.util.Stack; | import java.util.Stack; | ||||
import java.util.Vector; | import java.util.Vector; | ||||
@@ -518,4 +518,49 @@ public class Path extends DataType implements Cloneable { | |||||
} | } | ||||
/** | |||||
* Add the Java Runtime classes to this Path instance. | |||||
*/ | |||||
public void addJavaRuntime() { | |||||
if (System.getProperty("java.vendor").toLowerCase(Locale.US).indexOf("microsoft") >= 0) { | |||||
// Pull in *.zip from packages directory | |||||
FileSet msZipFiles = new FileSet(); | |||||
msZipFiles.setDir(new File(System.getProperty("java.home") + File.separator + "Packages")); | |||||
msZipFiles.setIncludes("*.ZIP"); | |||||
addFileset(msZipFiles); | |||||
} | |||||
else if (Project.getJavaVersion() == Project.JAVA_1_1) { | |||||
addExisting(new Path(null, | |||||
System.getProperty("java.home") | |||||
+ File.separator + "lib" | |||||
+ File.separator | |||||
+ "classes.zip")); | |||||
} else { | |||||
// JDK > 1.1 seems to set java.home to the JRE directory. | |||||
addExisting(new Path(null, | |||||
System.getProperty("java.home") | |||||
+ File.separator + "lib" | |||||
+ File.separator + "rt.jar")); | |||||
// Just keep the old version as well and let addExistingToPath | |||||
// sort it out. | |||||
addExisting(new Path(null, | |||||
System.getProperty("java.home") | |||||
+ File.separator +"jre" | |||||
+ File.separator + "lib" | |||||
+ File.separator + "rt.jar")); | |||||
// Added for MacOS X | |||||
addExisting(new Path(null, | |||||
System.getProperty("java.home") | |||||
+ File.separator + ".." | |||||
+ File.separator + "Classes" | |||||
+ File.separator + "classes.jar")); | |||||
addExisting(new Path(null, | |||||
System.getProperty("java.home") | |||||
+ File.separator + ".." | |||||
+ File.separator + "Classes" | |||||
+ File.separator + "ui.jar")); | |||||
} | |||||
} | |||||
} | } |