bodewig 00/07/04 03:03:40
Modified: src/main/org/apache/tools/ant/taskdefs Javac.java
Log:
Add the runtime classes to the compile classpath if using jikes.
Submitted by: Colin 't Hart <[EMAIL PROTECTED]>
Revision Changes Path
1.16 +23 -4
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Javac.java
Index: Javac.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Javac.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- Javac.java 2000/07/03 12:10:27 1.15
+++ Javac.java 2000/07/04 10:03:37 1.16
@@ -302,7 +302,11 @@
// XXX
// we need a way to not use the current classpath.
- private String getCompileClasspath() {
+ /**
+ * @param addRuntime Shall <code>rt.jar</code> or
+ * <code>classes.zip</code> be added to the classpath.
+ */
+ private String getCompileClasspath(boolean addRuntime) {
StringBuffer classpath = new StringBuffer();
// add dest dir to classpath so that previously compiled and
@@ -321,6 +325,21 @@
// add the system classpath
addExistingToClasspath(classpath,System.getProperty("java.class.path"));
+ if (addRuntime) {
+ if (Project.getJavaVersion() == Project.JAVA_1_1) {
+ addExistingToClasspath(classpath,
+ System.getProperty("java.home")
+ + File.separator + "lib"
+ + File.separator + "classes.zip");
+ } else {
+ addExistingToClasspath(classpath,
+ System.getProperty("java.home")
+ + File.separator +"jre"
+ + File.separator + "lib"
+ + File.separator + "rt.jar");
+ }
+ }
+
return classpath.toString();
}
@@ -360,7 +379,7 @@
private void doClassicCompile() throws BuildException {
project.log("Using classic compiler", project.MSG_VERBOSE);
- String classpath = getCompileClasspath();
+ String classpath = getCompileClasspath(false);
Vector argList = new Vector();
if (deprecation == true)
@@ -441,7 +460,7 @@
private void doModernCompile() throws BuildException {
project.log("Using modern compiler", project.MSG_VERBOSE);
- String classpath = getCompileClasspath();
+ String classpath = getCompileClasspath(false);
Vector argList = new Vector();
if (deprecation == true)
@@ -538,7 +557,7 @@
project.log("Using jikes compiler",project.MSG_VERBOSE);
StringBuffer classpath = new StringBuffer();
- classpath.append(getCompileClasspath());
+ classpath.append(getCompileClasspath(true));
// Jikes doesn't support an extension dir (-extdir)
// so we'll emulate it for compatibility and convenience.