javap.1 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  1. '\" t
  2. .\" Copyright (c) 1994, 2014, Oracle and/or its affiliates. All rights reserved.
  3. .\"
  4. .\" Title: javap
  5. .\" Language: English
  6. .\" Date: 8 August 2014
  7. .\" SectDesc: Basic Tools
  8. .\" Software: JDK 8
  9. .\" Arch: generic
  10. .\" Part Number: E38209-03
  11. .\"
  12. .if n .pl 99999
  13. .TH "javap" "1" "8 August 2014" "JDK 8" "Basic Tools"
  14. .\" -----------------------------------------------------------------
  15. .\" * Define some portability stuff
  16. .\" -----------------------------------------------------------------
  17. .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  18. .\" http://bugs.debian.org/507673
  19. .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
  20. .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  21. .ie \n(.g .ds Aq \(aq
  22. .el .ds Aq '
  23. .\" -----------------------------------------------------------------
  24. .\" * set default formatting
  25. .\" -----------------------------------------------------------------
  26. .\" disable hyphenation
  27. .nh
  28. .\" disable justification (adjust text to left margin only)
  29. .ad l
  30. .\" -----------------------------------------------------------------
  31. .\" * MAIN CONTENT STARTS HERE *
  32. .\" -----------------------------------------------------------------
  33. .SH "NAME"
  34. javap \- Disassembles one or more class files\&.
  35. .SH "SYNOPSIS"
  36. .sp
  37. .if n \{\
  38. .RS 4
  39. .\}
  40. .nf
  41. \fBjavap\fR [\fIoptions\fR] \fIclassfile\fR\&.\&.\&.
  42. .fi
  43. .if n \{\
  44. .RE
  45. .\}
  46. .PP
  47. \fIoptions\fR
  48. .RS 4
  49. The command\-line options\&. See Options\&.
  50. .RE
  51. .PP
  52. \fIclassfile\fR
  53. .RS 4
  54. One or more classes separated by spaces to be processed for annotations such as DocFooter\&.class\&. You can specify a class that can be found in the class path, by its file name or with a URL such as
  55. \fBfile:///home/user/myproject/src/DocFooter\&.class\fR\&.
  56. .RE
  57. .SH "DESCRIPTION"
  58. .PP
  59. The
  60. \fBjavap\fR
  61. command disassembles one or more class files\&. The output depends on the options used\&. When no options are used, then the
  62. \fBjavap\fR
  63. command prints the package, protected and public fields, and methods of the classes passed to it\&. The
  64. \fBjavap\fR
  65. command prints its output to
  66. \fBstdout\fR\&.
  67. .SH "OPTIONS"
  68. .PP
  69. \-help
  70. .br
  71. \-\-help
  72. .br
  73. \-?
  74. .RS 4
  75. Prints a help message for the
  76. \fBjavap\fR
  77. command\&.
  78. .RE
  79. .PP
  80. \-version
  81. .RS 4
  82. Prints release information\&.
  83. .RE
  84. .PP
  85. \-l
  86. .RS 4
  87. Prints line and local variable tables\&.
  88. .RE
  89. .PP
  90. \-public
  91. .RS 4
  92. Shows only public classes and members\&.
  93. .RE
  94. .PP
  95. \-protected
  96. .RS 4
  97. Shows only protected and public classes and members\&.
  98. .RE
  99. .PP
  100. \-private
  101. .br
  102. \-p
  103. .RS 4
  104. Shows all classes and members\&.
  105. .RE
  106. .PP
  107. \-J\fIoption\fR
  108. .RS 4
  109. Passes the specified option to the JVM\&. For example:
  110. .sp
  111. .if n \{\
  112. .RS 4
  113. .\}
  114. .nf
  115. \fBjavap \-J\-version\fR
  116. \fBjavap \-J\-Djava\&.security\&.manager \-J\-Djava\&.security\&.policy=MyPolicy MyClassName\fR
  117. .fi
  118. .if n \{\
  119. .RE
  120. .\}
  121. For more information about JVM options, see the command documentation\&.
  122. .RE
  123. .PP
  124. \-s
  125. .RS 4
  126. Prints internal type signatures\&.
  127. .RE
  128. .PP
  129. \-sysinfo
  130. .RS 4
  131. Shows system information (path, size, date, MD5 hash) of the class being processed\&.
  132. .RE
  133. .PP
  134. \-constants
  135. .RS 4
  136. Shows
  137. \fBstatic final\fR
  138. constants\&.
  139. .RE
  140. .PP
  141. \-c
  142. .RS 4
  143. Prints disassembled code, for example, the instructions that comprise the Java bytecodes, for each of the methods in the class\&.
  144. .RE
  145. .PP
  146. \-verbose
  147. .RS 4
  148. Prints stack size, number of locals and arguments for methods\&.
  149. .RE
  150. .PP
  151. \-classpath \fIpath\fR
  152. .RS 4
  153. Specifies the path the
  154. \fBjavap\fR
  155. command uses to look up classes\&. Overrides the default or the
  156. \fBCLASSPATH\fR
  157. environment variable when it is set\&.
  158. .RE
  159. .PP
  160. \-bootclasspath \fIpath\fR
  161. .RS 4
  162. Specifies the path from which to load bootstrap classes\&. By default, the bootstrap classes are the classes that implement the core Java platform located in
  163. \fBjre/lib/rt\&.jar\fR
  164. and several other JAR files\&.
  165. .RE
  166. .PP
  167. \-extdir \fIdirs\fR
  168. .RS 4
  169. Overrides the location at which installed extensions are searched for\&. The default location for extensions is the value of
  170. \fBjava\&.ext\&.dirs\fR\&.
  171. .RE
  172. .SH "EXAMPLE"
  173. .PP
  174. Compile the following
  175. \fBDocFooter\fR
  176. class:
  177. .sp
  178. .if n \{\
  179. .RS 4
  180. .\}
  181. .nf
  182. \fBimport java\&.awt\&.*;\fR
  183. \fBimport java\&.applet\&.*;\fR
  184. \fB \fR
  185. \fBpublic class DocFooter extends Applet {\fR
  186. \fB String date;\fR
  187. \fB String email;\fR
  188. \fB \fR
  189. \fB public void init() {\fR
  190. \fB resize(500,100);\fR
  191. \fB date = getParameter("LAST_UPDATED");\fR
  192. \fB email = getParameter("EMAIL");\fR
  193. \fB }\fR
  194. \fB \fR
  195. \fB public void paint(Graphics g) {\fR
  196. \fB g\&.drawString(date + " by ",100, 15);\fR
  197. \fB g\&.drawString(email,290,15);\fR
  198. \fB }\fR
  199. \fB}\fR
  200. .fi
  201. .if n \{\
  202. .RE
  203. .\}
  204. .PP
  205. The output from the
  206. \fBjavap DocFooter\&.class\fR
  207. command yields the following:
  208. .sp
  209. .if n \{\
  210. .RS 4
  211. .\}
  212. .nf
  213. \fBCompiled from "DocFooter\&.java"\fR
  214. \fBpublic class DocFooter extends java\&.applet\&.Applet {\fR
  215. \fB java\&.lang\&.String date;\fR
  216. \fB java\&.lang\&.String email;\fR
  217. \fB public DocFooter();\fR
  218. \fB public void init();\fR
  219. \fB public void paint(java\&.awt\&.Graphics);\fR
  220. \fB}\fR
  221. .fi
  222. .if n \{\
  223. .RE
  224. .\}
  225. .PP
  226. The output from
  227. \fBjavap \-c DocFooter\&.class\fR
  228. command yields the following:
  229. .sp
  230. .if n \{\
  231. .RS 4
  232. .\}
  233. .nf
  234. \fBCompiled from "DocFooter\&.java"\fR
  235. \fBpublic class DocFooter extends java\&.applet\&.Applet {\fR
  236. \fB java\&.lang\&.String date;\fR
  237. \fB java\&.lang\&.String email;\fR
  238. \fB public DocFooter();\fR
  239. \fB Code:\fR
  240. \fB 0: aload_0 \fR
  241. \fB 1: invokespecial #1 // Method\fR
  242. \fBjava/applet/Applet\&."<init>":()V\fR
  243. \fB 4: return \fR
  244. \fB public void init();\fR
  245. \fB Code:\fR
  246. \fB 0: aload_0 \fR
  247. \fB 1: sipush 500\fR
  248. \fB 4: bipush 100\fR
  249. \fB 6: invokevirtual #2 // Method resize:(II)V\fR
  250. \fB 9: aload_0 \fR
  251. \fB 10: aload_0 \fR
  252. \fB 11: ldc #3 // String LAST_UPDATED\fR
  253. \fB 13: invokevirtual #4 // Method\fR
  254. \fB getParameter:(Ljava/lang/String;)Ljava/lang/String;\fR
  255. \fB 16: putfield #5 // Field date:Ljava/lang/String;\fR
  256. \fB 19: aload_0 \fR
  257. \fB 20: aload_0 \fR
  258. \fB 21: ldc #6 // String EMAIL\fR
  259. \fB 23: invokevirtual #4 // Method\fR
  260. \fB getParameter:(Ljava/lang/String;)Ljava/lang/String;\fR
  261. \fB 26: putfield #7 // Field email:Ljava/lang/String;\fR
  262. \fB 29: return \fR
  263. \fB public void paint(java\&.awt\&.Graphics);\fR
  264. \fB Code:\fR
  265. \fB 0: aload_1 \fR
  266. \fB 1: new #8 // class java/lang/StringBuilder\fR
  267. \fB 4: dup \fR
  268. \fB 5: invokespecial #9 // Method\fR
  269. \fB java/lang/StringBuilder\&."<init>":()V\fR
  270. \fB 8: aload_0 \fR
  271. \fB 9: getfield #5 // Field date:Ljava/lang/String;\fR
  272. \fB 12: invokevirtual #10 // Method\fR
  273. \fB java/lang/StringBuilder\&.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\fR
  274. \fB 15: ldc #11 // String by \fR
  275. \fB 17: invokevirtual #10 // Method\fR
  276. \fB java/lang/StringBuilder\&.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\fR
  277. \fB 20: invokevirtual #12 // Method\fR
  278. \fB java/lang/StringBuilder\&.toString:()Ljava/lang/String;\fR
  279. \fB 23: bipush 100\fR
  280. \fB 25: bipush 15\fR
  281. \fB 27: invokevirtual #13 // Method\fR
  282. \fB java/awt/Graphics\&.drawString:(Ljava/lang/String;II)V\fR
  283. \fB 30: aload_1 \fR
  284. \fB 31: aload_0 \fR
  285. \fB 32: getfield #7 // Field email:Ljava/lang/String;\fR
  286. \fB 35: sipush 290\fR
  287. \fB 38: bipush 15\fR
  288. \fB 40: invokevirtual #13 // Method\fR
  289. \fBjava/awt/Graphics\&.drawString:(Ljava/lang/String;II)V\fR
  290. \fB 43: return \fR
  291. \fB}\fR
  292. .fi
  293. .if n \{\
  294. .RE
  295. .\}
  296. .SH "SEE ALSO"
  297. .sp
  298. .RS 4
  299. .ie n \{\
  300. \h'-04'\(bu\h'+03'\c
  301. .\}
  302. .el \{\
  303. .sp -1
  304. .IP \(bu 2.3
  305. .\}
  306. java(1)
  307. .RE
  308. .sp
  309. .RS 4
  310. .ie n \{\
  311. \h'-04'\(bu\h'+03'\c
  312. .\}
  313. .el \{\
  314. .sp -1
  315. .IP \(bu 2.3
  316. .\}
  317. javac(1)
  318. .RE
  319. .sp
  320. .RS 4
  321. .ie n \{\
  322. \h'-04'\(bu\h'+03'\c
  323. .\}
  324. .el \{\
  325. .sp -1
  326. .IP \(bu 2.3
  327. .\}
  328. javadoc(1)
  329. .RE
  330. .sp
  331. .RS 4
  332. .ie n \{\
  333. \h'-04'\(bu\h'+03'\c
  334. .\}
  335. .el \{\
  336. .sp -1
  337. .IP \(bu 2.3
  338. .\}
  339. javah(1)
  340. .RE
  341. .sp
  342. .RS 4
  343. .ie n \{\
  344. \h'-04'\(bu\h'+03'\c
  345. .\}
  346. .el \{\
  347. .sp -1
  348. .IP \(bu 2.3
  349. .\}
  350. jdb(1)
  351. .RE
  352. .sp
  353. .RS 4
  354. .ie n \{\
  355. \h'-04'\(bu\h'+03'\c
  356. .\}
  357. .el \{\
  358. .sp -1
  359. .IP \(bu 2.3
  360. .\}
  361. jdeps(1)
  362. .RE
  363. .br
  364. 'pl 8.5i
  365. 'bp