## org.apache.tools.ant.taskdefs
Class Rmic

    java.lang.Object
      org.apache.tools.ant.ProjectComponent
          org.apache.tools.ant.Task
              org.apache.tools.ant.taskdefs.MatchingTask
                  org.apache.tools.ant.taskdefs.Rmic

All Implemented Interfaces:
  SelectorContainer

public class Rmic
extends MatchingTask

Runs the rmic compiler against classes.

Rmic can be run on a single class (as specified with the classname attribute) or a number of classes at once (all classes below base that are neither _Stub nor _Skel classes). If you want to rmic a single class and this class is a class nested into another class, you have to specify the classname in the form `Outer$$Inner` instead of `Outer.Inner`.

It is possible to refine the set of files that are being rmiced. This can be done with the includes, includesfile, excludes, excludesfile and defaultexcludes attributes. With the includes or includesfile attribute you specify the files you want to have included by using patterns. The exclude or excludesfile attribute is used to specify the files you want to have excluded. This is also done with patterns. And finally with the defaultexcludes attribute, you can specify whether you want to use default exclusions or not. See the section on directory based tasks, on how the inclusion/exclusion of files works, and how to write patterns.

This task forms an implicit FileSet and supports all attributes of `<fileset>` (`dir` becomes `base`) as well as the nested `<include>`, `<exclude>` and `<patternset>` elements.

It is possible to use different compilers. This can be selected with the "build.rmic" property or the `compiler` attribute. There are three choices:

- sun (the standard compiler of the JDK)
- kaffe (the standard compiler of Kaffe)
- weblogic

The miniRMI project contains a compiler implementation for this task as well, please consult miniRMI's documentation to learn how to use it.

Since:
  Ant 1.1
Author:
  duncan@x180.com, ludovic.claude@websitewatchers.co.uk, David Maclean david@cm.co.za, Stefan Bodewig, Takashi Okamoto tokamoto@rd.nttdata.co.jp

Nested Class Summary
`class` `Rmic.ImplementationSpecificArgument` Adds an "compiler" attribute to Commandline$Attribute used to filter command line attributes based on the current implementation.

Field Summary

Fields inherited from class org.apache.tools.ant.taskdefs.MatchingTask
`fileset, useDefaultExcludes`

Fields inherited from class org.apache.tools.ant.Task
`description, location, target, taskName, taskType, wrapper`

Fields inherited from class org.apache.tools.ant.ProjectComponent
`project`

Constructor Summary
`Rmic()`

Method Summary
`Path` `createClasspath()` Creates a nested classpath element.
`Rmic.ImplementationSpecificArgument` `createCompilerArg()` Adds an implementation specific command line argument.
`Path` `createExtdirs()` Maybe creates a nested extdirs element.
`void` `execute()` execute by creating an instance of an implementation class and getting to do the work
`java.io.File` `getBase()` Gets the base directory to output generated class.
`java.lang.String` `getClassname()` Gets the class name to compile.
`Path` `getClasspath()` Gets the classpath.
`java.util.Vector` `getCompileList()`
`java.lang.String` `getCompiler()` get the name of the current compiler
`java.lang.String[]` `getCurrentCompilerArgs()` Get the additional implementation specific command line arguments.
`boolean` `getDebug()` Gets the debug flag.
`Path` `getExtdirs()` Gets the extension directories that will be used during the compilation.
`java.util.Vector` `getFileList()` Gets file list to compile.
`boolean` `getFiltering()`
`boolean` `getIdl()` Gets IDL flags.
`java.lang.String` `getIdlopts()` Gets additional arguments for idl compile.
`boolean` `getIiop()` Gets iiop flags.
`java.lang.String` `getIiopopts()` Gets additional arguments for iiop.
`boolean` `getIncludeantruntime()` Gets whether or not the ant classpath is to be included in the task's classpath.
`boolean` `getIncludejavaruntime()` Gets whether or not the java runtime should be included in this task's classpath.
`java.lang.ClassLoader` `getLoader()` Classloader for the user-specified classpath.
`java.lang.Class` `getRemoteInterface(java.lang.Class testClass)` Returns the topmost interface that extends Remote for a given class - if one exists.
`java.io.File` `getSourceBase()` Gets the source dirs to find the source java files.
`java.lang.String` `getStubVersion()`
`boolean` `getVerify()` Get verify flag.
`boolean` `isValidRmiRemote(java.lang.String classname)` Load named class and test whether it can be rmic'ed
`protected void` `scanDir(java.io.File baseDir, java.lang.String[] files, FileNameMapper mapper)` Scans the directory looking for class files to be compiled.
`void` `setBase(java.io.File base)` Sets the location to store the compiled files; required
`void` `setClassname(java.lang.String classname)` Sets the the class to run `rmic` against; optional
`void` `setClasspath(Path classpath)` Set the classpath to be used for this compilation.
`void` `setClasspathRef(Reference r)` Adds to the classpath a reference to a <path> defined elsewhere.
`void` `setCompiler(java.lang.String compiler)` Sets the compiler implementation to use; optional, defaults to the value of the `build.rmic` property, or failing that, default compiler for the current VM
`void` `setDebug(boolean debug)` generate debug info (passes -g to rmic); optional, defaults to false
`void` `setExtdirs(Path extdirs)` Sets the extension directories that will be used during the compilation; optional.
`void` `setFiltering(boolean filter)` indicates whether token filtering should take place; optional, default=false
`void` `setIdl(boolean idl)` Indicates that IDL output should be generated.
`void` `setIdlopts(java.lang.String idlopts)` pass additional arguments for idl compile
`void` `setIiop(boolean iiop)` Indicates that IIOP compatible stubs should be generated; optional, defaults to false if not set.
`void` `setIiopopts(java.lang.String iiopopts)` Set additional arguments for iiop
`void` `setIncludeantruntime(boolean include)` Sets whether or not to include ant's own classpath in this task's classpath.
`void` `setIncludejavaruntime(boolean include)` task's classpath.
`void` `setSourceBase(java.io.File sourceBase)` optional directory to save generated source files to.
`void` `setStubVersion(java.lang.String stubVersion)` Specify the JDK version for the generated stub code.
`void` `setVerify(boolean verify)` Flag to enable verification so that the classes found by the directory match are checked to see if they implement java.rmi.Remote.

Methods inherited from class org.apache.tools.ant.taskdefs.MatchingTask

`addAnd, addContains, addCustom, addDate, addDepend, addDepth, addFilename, addMajority, addNone, addNot, addOr, addPresent, addSelector, addSize, appendSelector, createExclude, createExcludesFile, createInclude, createIncludesFile, createPatternSet, getDirectoryScanner, getImplicitFileSet, getSelectors, hasSelectors, selectorCount, selectorElements, setCaseSensitive, setDefaultexcludes, setExcludes, setExcludesfile, setFollowSymlinks, setIncludes, setIncludesfile, setProject, XsetIgnore, XsetItems`

Methods inherited from class org.apache.tools.ant.Task
`getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, handleErrorFlush, handleErrorOutput, handleFlush, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName`

Methods inherited from class org.apache.tools.ant.ProjectComponent
`getProject`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Rmic

    public Rmic()

Method Detail

### setBase

    public void setBase(java.io.File base)

  Sets the location to store the compiled files; required

### getBase

    public java.io.File getBase()

  Gets the base directory to output generated class.

### setClassname

    public void setClassname(java.lang.String classname)

  Sets the the class to run `rmic` against; optional

### getClassname

    public java.lang.String getClassname()

  Gets the class name to compile.

### setSourceBase

    public void setSourceBase(java.io.File sourceBase)

  optional directory to save generated source files to.

### getSourceBase

    public java.io.File getSourceBase()

  Gets the source dirs to find the source java files.

### setStubVersion

    public void setStubVersion(java.lang.String stubVersion)

  Specify the JDK version for the generated stub code. Specify "1.1" to pass the "-v1.1" option to rmic.

### getStubVersion

    public java.lang.String getStubVersion()

### setFiltering

    public void setFiltering(boolean filter)

  indicates whether token filtering should take place; optional, default=false

### getFiltering

    public boolean getFiltering()

### setDebug

    public void setDebug(boolean debug)

  generate debug info (passes -g to rmic); optional, defaults to false

### getDebug

    public boolean getDebug()

  Gets the debug flag.

### setClasspath

    public void setClasspath(Path classpath)

  Set the classpath to be used for this compilation.

### createClasspath

    public Path createClasspath()

  Creates a nested classpath element.

### setClasspathRef

    public void setClasspathRef(Reference r)

  Adds to the classpath a reference to a <path> defined elsewhere.

### getClasspath

    public Path getClasspath()

  Gets the classpath.

### setVerify

    public void setVerify(boolean verify)

  Flag to enable verification so that the classes found by the directory match are checked to see if they implement java.rmi.Remote. Optional; his defaults to false if not set.

### getVerify

    public boolean getVerify()

  Get verify flag.

### setIiop

    public void setIiop(boolean iiop)

  Indicates that IIOP compatible stubs should be generated; optional, defaults to false if not set.

### getIiop

    public boolean getIiop()

  Gets iiop flags.

### setIiopopts

    public void setIiopopts(java.lang.String iiopopts)

  Set additional arguments for iiop

### getIiopopts

    public java.lang.String getIiopopts()

  Gets additional arguments for iiop.

### setIdl

    public void setIdl(boolean idl)

  Indicates that IDL output should be generated. This defaults to false if not set.

### getIdl

    public boolean getIdl()

  Gets IDL flags.

### setIdlopts

    public void setIdlopts(java.lang.String idlopts)

  pass additional arguments for idl compile

### getIdlopts

    public java.lang.String getIdlopts()

  Gets additional arguments for idl compile.

### getFileList

    public java.util.Vector getFileList()

  Gets file list to compile.

### setIncludeantruntime

    public void setIncludeantruntime(boolean include)

  Sets whether or not to include ant's own classpath in this task's classpath. Optional; default is `true`.

### getIncludeantruntime

    public boolean getIncludeantruntime()

  Gets whether or not the ant classpath is to be included in the task's classpath.

### setIncludejavaruntime

    public void setIncludejavaruntime(boolean include)

  task's classpath. Enables or disables including the default run-time libraries from the executing VM; optional, defaults to false

### getIncludejavaruntime

    public boolean getIncludejavaruntime()

  Gets whether or not the java runtime should be included in this task's classpath.

### setExtdirs

    public void setExtdirs(Path extdirs)

  Sets the extension directories that will be used during the compilation; optional.

### createExtdirs

    public Path createExtdirs()

  Maybe creates a nested extdirs element.

### getExtdirs

    public Path getExtdirs()

  Gets the extension directories that will be used during the compilation.

### getCompileList

    public java.util.Vector getCompileList()

### setCompiler

    public void setCompiler(java.lang.String compiler)

  Sets the compiler implementation to use; optional, defaults to the value of the `build.rmic` property, or failing that, default compiler for the current VM

  Since:
    Ant 1.5

### getCompiler

    public java.lang.String getCompiler()

  get the name of the current compiler

  Since:
    Ant 1.5

### createCompilerArg

    public Rmic.ImplementationSpecificArgument createCompilerArg()

  Adds an implementation specific command line argument.

  Since:
    Ant 1.5

### getCurrentCompilerArgs

    public java.lang.String[] getCurrentCompilerArgs()

  Get the additional implementation specific command line arguments.

  Returns:
    array of command line arguments, guaranteed to be non-null.
  Since:
    Ant 1.5

### execute

    public void execute()
                 throws BuildException

  execute by creating an instance of an implementation class and getting to do the work

  Overrides:
    `execute` in class `Task`
  Throws:
    `BuildException` - if something goes wrong with the build

### scanDir

    protected void scanDir(java.io.File baseDir,
                           java.lang.String[] files,
                           FileNameMapper mapper)

  Scans the directory looking for class files to be compiled. The result is returned in the class variable compileList.

### isValidRmiRemote

    public boolean isValidRmiRemote(java.lang.String classname)

  Load named class and test whether it can be rmic'ed

### getRemoteInterface

    public java.lang.Class getRemoteInterface(java.lang.Class testClass)

  Returns the topmost interface that extends Remote for a given class - if one exists.

### getLoader

    public java.lang.ClassLoader getLoader()

  Classloader for the user-specified classpath.

Copyright © 2000-2003 Apache Software Foundation. All Rights Reserved.