原文链接: http://extreme-java.blogspot.com/2011/01/java-verbose-options-for-running.html
There are basically three sub parameters with the javac verbose parameter:
verbose参数有三个基本的子参数:
-verbose:class
-verbose:gc
-verbose:jni
To give you an idea of the number of classes loaded when you fire the java commond, here is the most simple program.
package example.java;
public class Test{
public static void main(String args[]) {
System.out.println("Hello World");
}
}
I will run it using the -verbose:class option to see how many classes have been loaded into the memory. If you are running the program from command line then you can use the command:
java -verbose:class Test
The output shown to you will be:
[Loaded java.lang.Object from shared objects file]
[Loaded java.io.Serializable from shared objects file]
[Loaded java.lang.Comparable from shared objects file]
[Loaded java.lang.CharSequence from shared objects file]
[Loaded java.lang.String from shared objects file]
[Loaded java.lang.reflect.GenericDeclaration from shared objects file]
[Loaded java.lang.reflect.Type from shared objects file]
.............
.............
[Loaded java.security.ProtectionDomain$2 from C:\Program Files (x86)\Java\jre6\lib\rt.jar]
[Loaded java.security.ProtectionDomain$Key from C:\Program Files (x86)\Java\jre6\lib\rt.jar]
[Loaded java.security.Principal from shared objects file]
[Loaded example.java.Test from file:/C:/Sandeep/Projects/Workspace/test/bin/]
Hello World
[Loaded java.lang.Shutdown from shared objects file]
[Loaded java.lang.Shutdown$Lock from shared objects file]
Thus we can see that such a huge number of classes are loaded for a simple Hello World program. You can imagine the number of classes loaded when you have very complex system to automate with web applications also comming into the picture.
The story of verbose doesn't end here. You can also see when a garbage collection runs. This option can be handy when performing garbage collection is serious to your program. The modified code will be:
当垃圾回收对你的程序很重要时,gc子参数就显得很方便了:
package example.java;
public class Test{
public static void main(String args[]) {
System.out.println("Hello World");
System.gc();
}
}
If you run the above program as java -verbose:gc Test, the you will see the following line in the output:
[Full GC 281K->123K(15872K), 0.0148661 secs]
This can suggest you when the garbage collector runs.
On the similar lines, if you run the above Test program with -verbose:jni option then the following output will be shown:
[Dynamic-linking native method java.lang.Object.registerNatives ... JNI]
[Registering JNI native method java.lang.Object.hashCode]
..................
..................
[Dynamic-linking native method java.lang.Compiler.registerNatives ... JNI]
[Registering JNI native method java.lang.Compiler.compileClass]
[Registering JNI native method java.lang.Compiler.compileClasses]
[Registering JNI native method java.lang.Compiler.command]
[Registering JNI native method java.lang.Compiler.enable]
[Registering JNI native method java.lang.Compiler.disable]
[Dynamic-linking native method java.lang.ClassLoader$NativeLibrary.find ...
[Dynamic-linking native method java.io.FileOutputStream.writeBytes ... JNI]
Hello World
[Dynamic-linking native method java.lang.Runtime.gc ... JNI]
[Dynamic-linking native method java.lang.ref.Finalizer.invokeFinalizeMethod ... JNI]
分享到:
相关推荐
or java [-options] -jar jarfile [args...] (to execute a jar file) where options include: -d32 use a 32-bit data model if available -d64 use a 64-bit data model if available -client to select the...
通过which mysqld命令来查看mysql的安装位置*2.{{ which mysqld result}} --verbose --help |grep -A 1 'Default options'*3. 修改以下值:[mysqld]sql_mode = "STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,...
rdbms2graphql generate --jdbc-url=<JDBC> --jdbc-driver=<JDBC> --username=<USERNAME> --password=<PASSWORD> [--schema=] [--tables=] [--output-dir=] [--verbose] rdbms2graphql --version rdbms2graphql ...
复制者 用于轻量级存储库生成器。 虚拟机 平台 状态 OpenJDK LTS Linux OpenJDK当前 Linux OpenJDK当前 ...从APK文件目录中高效生成存储库文件。... 从OPDS软件包文件列表中高效... --verbose Set the minimum logging
-type js --charset utf-8 -v src.js > packed.js //压缩CSS java -jar yuicompressor-2.4.2.jar --type css --charset utf-8 -v src.css > packed.css 语法: java -jar yuicompressor-x.y.z.jar [options] [input ...
语法: java -jar yuicompressor-x.y.z.jar [options] [input file] 通用参数: -h, --help 显示帮助信息 --type |css> 指定输入文件的文件类型 --charset <charset> 指定读取输入文件使用的编码 --line-break ...
Pal2StarDict “ ”中的帕劳语到 StarDict 转换器 Usage : java -jar Pal2StarDict.jar mysql-jdbc-url user pass filename [options]eg) java -jar Pal2StarDict.jar jdbc:mysql://127.0.0.1/palauan root pass /...
此程序能帮助你实现将命令行程序变成服务运行,比如将"java -jar xxx.jar" 放在后台执行。 ./start-stop-daemon --help start-stop-daemon 1.9.18 for Debian - small and fast C version written by Marek ...
formatted data for consumption by a script.Default is false. Name Synopsis Description Options start-domain(1) Sun Java System Application 658 Server 9.1 ...
#commons-cli-annotations# Apache 是一个标准库,用于解析 Java 中的命令行参数。 尽管它的功能足够了,但该库不提供对注释的支持。 这个对 commons-cli 库的扩展使您能够简单地注释 POJO 类的属性,以使用从...
git-relocate 在 git repo 中移动或克隆完整子树的实用程序 ... --verbose --branches=[move|clone|skip] (default: move) --tags=[move|clone|skip] (default: move) These flags specify how to handle
Verbose Reporting 73 Enable Global Services 74 Table of Contents [ iii ] Proxy Base URL 74 Logging Profile 74 Log to StdOut 74 Log location 74 Time for action – changing your logging configuration 74...
apks are nothing more than a zip file containing resources and compiled java. If you were to simply unzip an apk like so, you would be left with files such as classes.dex and resources.arsc. $ unzip...
Options Logger.d("debug"); Logger.e("error"); Logger.w("warning"); Logger.v("verbose"); Logger.i("information"); Logger.wtf("wtf!!!!"); String format arguments are supported Logger.d("hello %s", ...
logcat [options] [filterspecs] logcat的选项包括: -s 设置过滤器,例如指定 '*:s' -f <filename> 输出到文件,默认情况是标准输出。 -r [] Rotate log every kbytes. (16 if unspecified). Requires -f -n ...
./falcaun [OPTIONS] --stl=[STLFormula] --input-mapper=[InputMapperFile] --output-mapper=[OutputMapperFile] --equiv=[HC|random|WP|SA|GA] 常规选项 -h,--help打印帮助信息。 -v ,-- verbose输出额外的信息...