diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 5dea6ecda..45c04e1eb 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -242,6 +242,7 @@ Ulrich Schmidt
Waldek Herka
Will Wang
William Ferguson
+Wolfgang Frech
Wolfgang Werner
Wolf Siberski
Yohann Roussel
diff --git a/contributors.xml b/contributors.xml
index 70fe5576e..24ae73a23 100644
--- a/contributors.xml
+++ b/contributors.xml
@@ -958,6 +958,10 @@
The parameter of the jar attribute is of type File; that is, the parameter is resolved to an absolute file relative to the base directory of the project, not the directory in which the Java task is run. If you need to locate a JAR file relative to the directory the task will be run in, you need to explicitly create the full path -to the JAR file. +to the JAR file.
+When using the jar attribute, all classpath settings are +ignored according to Sun's +specification.
java ="-Xrunhprof:cpu=samples,file=log.txt,depth=3 -DDEBUG=true test.Main
<java classname="ShowJavaVersion" classpath="." jvm="path-to-java14-home/bin/java" fork="true" taskname="java1.4" >-Use a given Java implementation (another the one Ant is currently using) to run the class. +Use a given Java implementation (another the one Ant is currently using) to run the class. For documentation in the log
taskname
is used to change the [java]
log-prefix to [java1.4]
.
diff --git a/src/main/org/apache/tools/ant/taskdefs/Java.java b/src/main/org/apache/tools/ant/taskdefs/Java.java
index 4f8aa42bd..aed95cfb6 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Java.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Java.java
@@ -116,7 +116,7 @@ public class Java extends Task {
* Do the execution and return a return code.
*
* @return the return code from the execute java class if it was
- * executed in a separate VM (fork = "yes") or a security manager was
+ * executed in a separate VM (fork = "yes") or a security manager was
* installed that prohibits ExitVM (default).
*
* @throws BuildException if required parameters are missing.
@@ -134,6 +134,10 @@ public class Java extends Task {
throw new BuildException("Cannot spawn a java process in non-forked mode."
+ " Please set fork='true'. ");
}
+ if (cmdl.getClasspath()!=null && cmdl.getJar()!=null) {
+ log("When using 'jar' attribute classpath-settings are ignored. "
+ + "See the manual for more information.", Project.MSG_VERBOSE);
+ }
if (spawn && incompatibleWithSpawn) {
getProject().log("spawn does not allow attributes related to input, "
+ "output, error, result", Project.MSG_ERR);
@@ -925,4 +929,4 @@ public class Java extends Task {
public CommandlineJava.SysProperties getSysProperties() {
return cmdl.getSystemProperties();
}
-}
+}
\ No newline at end of file