Directory Structure when using Packages
- The directory structure must match the package name structure.
- When you run the class the full class name must be supplied i.e. "com.example.HelloWorld"
- You don't have to compile and run the javacode out of the current directory.
Commonly used javac options
- - d option sets a destination directory for writing the ".class" files
- - sourcepath option sets a source code search path.
- -cp or -classpath option sets the search path for finding external and previously compiled classes.
- -version option prints out compiler's version information.
- -target is used to compile code to an older version of java.
- -source recompile older java code to newer java platform to run on new platform.
- javac -source 1.4 oldsyntax.java
- javac -target 1.4 SomeClass.java
- -bootclass path - used to compile against an alternative set of run-time libraries
- javac -target 1.4 --bootclaspath path/to/java 1.4/rt.jar SomeClass.java
No comments:
Post a Comment