- "javac" Command


How to run "javac" command from JDK tools.jar file?

✍: FYIcenter


"javac" is the Java compiler command that allows you to compile Java source code into Java class binary file.

"javac" command is supported by the lib\tools.jar JAR file JDK 1, 2, 3, 4, 5, 6, 7, and 8.

You can run the "javac" command using the JDK tools.jar file as described below using JDK 8 as an example:

C:\fyicenter>set JDK_HOME=\fyicenter\jdk-1.8.0_191

C:\fyicenter>%JDK_HOME%\bin\java -cp %JDK_HOME%\lib\tools.jar

Usage: javac <options> <source files>

where <options> includes:
  -g                     Generate all debugging info
  -g:none                Generate no debugging info
  -g:{lines,vars,source} Generate only some debugging info
  -O                     Optimize; may hinder debugging or enlarge class files
  -nowarn                Generate no warnings
  -verbose               Output messages about what the compiler is doing
  -deprecation           Output source locations where deprecated APIs are used
  -classpath <path>      Specify where to find user class files
  -sourcepath <path>     Specify where to find input source files
  -bootclasspath <path>  Override location of bootstrap class files
  -extdirs <dirs>        Override location of installed extensions
  -d <directory>         Specify where to place generated class files
  -encoding <encoding>   Specify character encoding used by source files
  -target <release>      Generate class files for specific VM version


⇒ - "jar" Command

⇐ Tools Supported from JDK 8- JAR Files

⇑ Tools Supported from JDK 8- JAR Files

⇑⇑ FAQ for JDK (Java Development Kit)

2017-07-11, 15444👍, 0💬