Reputation: 8437
Even the official documentation of javac
says nothing about the -version option.
Upvotes: 3
Views: 22309
Reputation: 1690
Javac -version tells you about the JDK version. That is, it gives the information of Compiler.
Upvotes: 7
Reputation: 718798
You are looking at the official documentation for an OBSOLETE version of javac
Java 5. The -version
option is documented in the javac
manual entry for Java 6 and Java 7.
And in response to your question about what -version
actually shows (for javac
and java
) the best answer is "unspecified" or "it depends on what version / platform you are using". In practice, your best bet is to just try it for yourself.
If your reason for asking is that you want to extract some useful information about the Java platform from the version strings ... I recently tried searching for a web page that listed the version strings for the java
command, and came up empty. A better approach would probably be to write a tiny Java application to print out the relevant properties from the System
properties object. The javadoc for System
lists a number of properties that are standardised.
Upvotes: 1
Reputation: 5284
Just to expand, both display the same; the version of Java that the tools are part of.
You can ASSUME that what one reports, the other will automatically also report and so it is overkill to have the option in both. Until the moment you encounter a machine where there are multiple versions of Java installed and you can compile something yet you can't run it. Displaying the versions of javac and java can then quickly tell you that the setup of the machine is messed up enough that different versions of Java are being used to compile and run. And then you thank the designers for adding it in.
Upvotes: 1
Reputation: 40036
Official page does mention about it:
http://docs.oracle.com/javase/6/docs/technotes/tools/windows/javac.html
Why you cannot find on the page is, -version
is not available for javac
until Java 6 I believe (I am sure it is not available in 1.4 and before). That's why it is not showing on your page, which is javac
ref page for Java 1.5. However, go to java
command reference page of Java 1.5 and you should be able to find the -version
switch.
Upvotes: 2
Reputation: 8347
This command outputs your java compiler's version. In mine case it shows 1.6.0
Upvotes: 1