'javac' Command
Description
Compile java files.
Technical Specification (partial)
javac [options] [sourcefiles]
- -cp or -classpath path - ':' or ';' separated list of locations to search for source files
- -sourcepath path - ':' or ';' separated list of location to search for classes, interfaces, etc
- -d directory - the destination for .class files
- does not create target directory
- does create package path directories
Notes
- Classpath Searching:
- JRE
- Environment Variable (classpath)
- Command-Line Classpath (overrides environment variable)
- Directory Delimitor: unix '/', Mac '/', Windows '\'
- Classpath Separator: unix ':', Mac ':', Windows ';'
- Current Directory: '.'
- First class found is the one used. Searching stops when first class is found.
Examples
bash script
javac -d build -sourcepath src src/com/bryanpugh/scjp/MyClass.java
ant
<project basedir="."> <target name="compile"> <mkdir dir="build"/> <javac srcdir="src" destdir="build"/>
</target name="compile">
</project>
No comments:
Post a Comment