diff --git a/WHATSNEW b/WHATSNEW index ce93e0d4c..d5c9e14db 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -765,6 +765,10 @@ Other changes: executable. Bugzilla Report 46230. + * 's new executable attribute can be used to specify a + different executable. + Bugzilla Report 42132. + Changes from Ant 1.7.0 TO Ant 1.7.1 ============================================= diff --git a/docs/manual/CoreTasks/rmic.html b/docs/manual/CoreTasks/rmic.html index d5901c5be..817f22848 100644 --- a/docs/manual/CoreTasks/rmic.html +++ b/docs/manual/CoreTasks/rmic.html @@ -208,6 +208,16 @@ please consult miniRMI's documentation to learn how to use it.

compilers.) No + + executable + Complete path to the rmic + executable to use in case of the forking + or xnew compiler. + Defaults to the rmic compiler of the Java version that is currently + running Ant.
+ Since Ant 1.8.0. + No +

Parameters specified as nested elements

classpath and extdirs

diff --git a/src/main/org/apache/tools/ant/taskdefs/Rmic.java b/src/main/org/apache/tools/ant/taskdefs/Rmic.java index 830b52517..a69f87360 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Rmic.java +++ b/src/main/org/apache/tools/ant/taskdefs/Rmic.java @@ -123,6 +123,8 @@ public class Rmic extends MatchingTask { private static final FileUtils FILE_UTILS = FileUtils.getFileUtils(); + private String executable = null; + /** * Constructor for Rmic. */ @@ -488,6 +490,25 @@ public class Rmic extends MatchingTask { return facade.getArgs(); } + /** + * Name of the executable to use when forking. + * + * @since Ant 1.8.0 + */ + public void setExecutable(String ex) { + executable = ex; + } + + /** + * Explicitly specified name of the executable to use when forking + * - if any. + * + * @since Ant 1.8.0 + */ + public String getExecutable() { + return executable; + } + /** * execute by creating an instance of an implementation * class and getting to do the work diff --git a/src/main/org/apache/tools/ant/taskdefs/rmic/ForkingSunRmic.java b/src/main/org/apache/tools/ant/taskdefs/rmic/ForkingSunRmic.java index 7e187d1ba..dabee7057 100644 --- a/src/main/org/apache/tools/ant/taskdefs/rmic/ForkingSunRmic.java +++ b/src/main/org/apache/tools/ant/taskdefs/rmic/ForkingSunRmic.java @@ -54,8 +54,13 @@ public class ForkingSunRmic extends DefaultRmicAdapter { Rmic owner = getRmic(); Commandline cmd = setupRmicCommand(); Project project = owner.getProject(); - //rely on RMIC being on the path - cmd.setExecutable(JavaEnvUtils.getJdkExecutable(getExecutableName())); + String executable = owner.getExecutable(); + if (executable == null) { + // no explicitly specified executable + // rely on RMIC being on the path + executable = JavaEnvUtils.getJdkExecutable(getExecutableName()); + } + cmd.setExecutable(executable); //set up the args String[] args = cmd.getCommandline();