• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

javac -version?

 
Layne Lund
Ranch Hand
Posts: 3061
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know you can type "java -version" to get the version of the JRE that will be used from the command line. As far as I have seen, there is no equivalent for javac, though? Does anyone know why not? Or am I just retarded and can't find it. I can easily imagine a situation where the javac executable is a different version from the java executable. (In fact, I have encountered this lately because on a particular machine that I use "java -version" reports that it is indeed using Java 1.5. However, javac is complaining about generics and other new syntax. Does anyone have any ideas about this?

Layne
 
Jimmy Die
Ranch Hand
Posts: 97
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Really it's variable, because you can assign which release you want to use as long as the release version you use is earlier then the one you are compiling with. So how to find what the latest version javac is using to compile?
run
javac -source 1.5

If it is using 1.5 javac you get message "no source files"
If it is not using 1.5 you get message "invalid source release"

Run the same test using 1.4, 1.3 ... on and on..

Cheers
 
Marilyn de Queiroz
Sheriff
Posts: 9059
12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try "javac -J-version" unless you're using Java 5 which has a -version switch on javac.
 
Layne Lund
Ranch Hand
Posts: 3061
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the suggestions. That seems to give me the information I am looking for. Strangely a machine I have an account on has the version 1.5 for java, but only 1.4 for javac. I'll have to ask an admin about that.

Layne
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic