• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

javac -version?

 
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic