How do I compile to a different location?
By default, execution of the "javac" compiler produces .class files in the same directory where the source code files are located. This location for the generated .class files can be changed using the "-d" switch.
I have a Howdy.java file in my C:\stuff directory. Within the C:\stuff directory is another directory, C:\stuff\bin. I'll compile the Howdy java source file to a class file which will be placed in the bin directory via:
Javac will create appropriate directory structure (matching package name hierarchy) starting at destination directory specified.
By default, execution of the "javac" compiler produces .class files in the same directory where the source code files are located. This location for the generated .class files can be changed using the "-d" switch.
I have a Howdy.java file in my C:\stuff directory. Within the C:\stuff directory is another directory, C:\stuff\bin. I'll compile the Howdy java source file to a class file which will be placed in the bin directory via:
javac -d bin Howdy.javaAfter compilation, we can see that the Howdy.class file has been created in the bin directory.
Javac will create appropriate directory structure (matching package name hierarchy) starting at destination directory specified.
No comments:
Post a Comment