javac version

I just typed injavac -version on the command line once and found something very funny.

C:\>javac -version

javac 1.5.0_12

javac:no source files

Usage: javac <options> <source files>

where possible options include:

-g Generate all debugging info

-g:noneGenerate no debugging info

-g:{lines,vars,source}Generate only some debugging info

-nowarnGenerate no warnings

-verboseOutput messages about what the compiler is doing

-deprecationOutput source locations where deprecated APIs are u

sed

-classpath <path> Specify where to find user class files

-cp <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

-endorseddirs <dirs>Override location of endorsed standards path

-d <directory> Specify where to place generated class files

-encoding <encoding>Specify character encoding used by source files

-source <release> Provide source compatibility with specified release

-target <release> Generate class files for specific VM version

-versionVersion information

-help Print a synopsis of standard options

-X Print a synopsis of nonstandard options

-J<flag>Pass <flag> directly to the runtime system

If -version is supposed to print the version information why should it display a message for source files? While usingjava -version, it doesn't prompt for class files.

Is this an inconsistency or am I just bored?

[1754 byte] By [aniseeda] at [2007-11-27 10:29:16]
# 1

Written by different teams, I expect. One of which thought -version should only show a version number, and the other that thought it might be nice to display the help text.

I dimly recall -version once not being a switch at all on javac, thus generating the help text to indicate usage. Might be a throwback to that. But I could be completely wrong on both counts there!

georgemca at 2007-7-28 17:56:30 > top of Java-index,Java Essentials,Java Programming...
# 2

> Written by different teams, I expect.

That's a good possibility.

> I could be completely wrong on both counts there!

That doesn't matter - this is a duke distribution thread. ;)

aniseeda at 2007-7-28 17:56:30 > top of Java-index,Java Essentials,Java Programming...
# 3

> That doesn't matter - this is a duke distribution

> thread. ;)

Aha. Who's involved in the scam?

georgemca at 2007-7-28 17:56:30 > top of Java-index,Java Essentials,Java Programming...
# 4

> > That doesn't matter - this is a duke distribution

> > thread. ;)

>

> Aha. Who's involved in the scam?

Nobody! I had some dukes and I'm bored. :)

aniseeda at 2007-7-28 17:56:30 > top of Java-index,Java Essentials,Java Programming...
# 5

> > > That doesn't matter - this is a duke

> distribution

> > > thread. ;)

> >

> > Aha. Who's involved in the scam?

>

> Nobody! I had some dukes and I'm bored. :)

Furry muff! Duke philanthropy, eh. Btw, don't ever go to dukedollars.com whilst at work - it's not what you might expect (I hope)

georgemca at 2007-7-28 17:56:30 > top of Java-index,Java Essentials,Java Programming...
# 6

C:\source\java\ebanx\rtl\web\WEB-INF\config\properties>java -version

java version "1.4.2_03"

Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_03-b02)

Java HotSpot(TM) Client VM (build 1.4.2_03-b02, mixed mode)

C:\source\java\ebanx\rtl\web\WEB-INF\config\properties>javac -version

C:\source\java\ebanx\rtl\web\WEB-INF\config\properties>C:\langs\java\j2sdk1.4.2\bin\javac.exe -version

javac: invalid flag: -version

Usage: javac <options> <source files>

where possible options include:

-gGenerate all debugging info

-g:noneGenerate no debugging info

-g:{lines,vars,source}Generate only some debugging info

-nowarnGenerate no warnings

-verboseOutput 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

-source <release> Provide source compatibility with specified release

-target <release> Generate class files for specific VM version

-help Print a synopsis of standard options

BIJ001a at 2007-7-28 17:56:30 > top of Java-index,Java Essentials,Java Programming...
# 7

> Btw, don't ever go to dukedollars.com whilst at work

Rember thsi advices.

I am wondering - would I have been tempted to visit that site (even at home) if someone would have not mentioned it to me? ;)

aniseeda at 2007-7-28 17:56:30 > top of Java-index,Java Essentials,Java Programming...
# 8

>

> C:\source\java\ebanx\rtl\web\WEB-INF\config\properties

> >java -version

> java version "1.4.2_03"

> Java(TM) 2 Runtime Environment, Standard Edition

> (build 1.4.2_03-b02)

> Java HotSpot(TM) Client VM (build 1.4.2_03-b02, mixed

> mode)

>

> C:\source\java\ebanx\rtl\web\WEB-INF\config\properties

> >javac -version

>

> C:\source\java\ebanx\rtl\web\WEB-INF\config\properties

> >C:\langs\java\j2sdk1.4.2\bin\javac.exe -version

> javac: invalid flag: -version

> Usage: javac <options> <source files>

> where possible options include:

> -gGenerate all debugging

> info

> -g:noneGenerate no debugging

> info

> -g:{lines,vars,source}Generate only some

> debugging info

> -nowarnGenerate no warnings

> -verboseOutput 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

> -source <release> Provide source

> compatibility with specified release

> -target <release> Generate class files for

> specific VM version

> -help Print a synopsis of

> standard options

> /pre]

Aha! I knew I remembered that from the "dim-and-distant" past

Cheers

georgemca at 2007-7-28 17:56:30 > top of Java-index,Java Essentials,Java Programming...
# 9

> >java -version

> java version "1.4.2_03"

> >javac -version

> javac: invalid flag: -version

So it something that happened after 1.4 :)

aniseeda at 2007-7-28 17:56:30 > top of Java-index,Java Essentials,Java Programming...