This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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?
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"
Try "javac -J-version" unless you're using Java 5 which has a -version switch on javac.
JavaBeginnersFaq "Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Joined: Dec 06, 2001
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.