about javac

/*
*-----------------------------------------------------------------------
*/
javac(compile.execute)]
javac <options> <source>
what i will say is the important options which a java programer should know.
-verbose :show the process of compiling which is a good thing for realizing the java's compiling.
an example of show:
[parsing started /home/zvin/desktop/Hello.java]
[parsing completed 18ms]
[search path for source files: /home/zvin/desktop]
[search path for class files: /usr/lib/jvm/java-6-sun-1.6.0.15/jre/lib/resources.jar,/usr/lib/jvm/java-6-sun-1.6.0.15/jre/lib/rt.jar,/usr/lib/jvm/java-6-sun-1.6.0.15/jre/lib/sunrsasign.jar,/usr/lib/jvm/java-6-sun-1.6.0.15/jre/lib/jsse.jar,/usr/lib/jvm/java-6-sun-1.6.0.15/jre/lib/jce.jar,/usr/lib/jvm/java-6-sun-1.6.0.15/jre/lib/charsets.jar,/usr/lib/jvm/java-6-sun-1.6.0.15/jre/classes,/usr/lib/jvm/java-6-sun-1.6.0.15/jre/lib/ext/sunjce_provider.jar,/usr/lib/jvm/java-6-sun-1.6.0.15/jre/lib/ext/localedata.jar,/usr/lib/jvm/java-6-sun-1.6.0.15/jre/lib/ext/dnsns.jar,/usr/lib/jvm/java-6-sun-1.6.0.15/jre/lib/ext/sunpkcs11.jar,/home/zvin/desktop]
[loading /home/zvin/desktop/test2/Test.class]
[loading java/lang/Object.class(java/lang:Object.class)]
[loading java/lang/String.class(java/lang:String.class)]
[checking test1.Hello]
[loading java/lang/System.class(java/lang:System.class)]
[loading java/io/PrintStream.class(java/io:PrintStream.class)]
[loading java/io/FilterOutputStream.class(java/io:FilterOutputStream.class)]
[loading java/io/OutputStream.class(java/io:OutputStream.class)]
[wrote /home/zvin/desktop/Hello.class]
[total 165ms]

-classpath||-cp <path> :specify the path where the *.class files or annotation that compiling source.java needs
note:the <path> don't include the package path(use /usr/home/zvin rather than /usr/home/zvin/java/lang/String.class).
an example:
javac -classpath /usr/home/zvin HelloWorld.java

-sourcepath <path> :specify the path of source java files which compiling needs.
note:the source java files found to help compile will also be compiling that you can understand if you known the principle of java's compile.
note:the <path> don't include the package path(use /usr/home/zvin rather than /usr/home/zvin/java/lang/String.java).
an example:javac -sourcepath /usr/home/zvin/desktop /home/zvin/HelloWorld.java

-d <directory> :specify the directory where you want your generated class files exit
note:if you don't use -d option,compiler will put generated class files defautly where your source java file is in without the package path.
so,use -d option is quite successary.

finally,a better simple javac command should like this:javac -classpath <path> -d <directory> <source>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值