ggkmath
ggkmath

Reputation: 4246

Java: newbie "javac: invalid flag" compile error

I'm trying to compile a Java 1.6 program. The following compiles without error:

# javac -cp /path/to/ojdbc6.jar:. MyJavaProgram.java

But adding a flag causes this error:

# javac -cp /path/to/ojdbc6.jar:. -Doracle.jdbc.SetFloatAndDoubleUseBinary=true MyJavaProgram.java -help
javac: invalid flag: -Doracle.jdbc.SetFloatAndDoubleUseBinary=true
Usage: javac <options> <source files>
use -help for a list of possible options

Is the flag not supported? I added the -help but it didn't give any more info (did I add it in the right place above?).

Upvotes: 0

Views: 13776

Answers (1)

hmjd
hmjd

Reputation: 121971

The options must come before the source files (as indicated in your question): remove the -help.

-D option specify properties and are passed to the JVM (java) and are not compile time flags. From java -help:

-D<name>=<value>
       set a system property

To view the list of available compiler options execute:

javac -help

Upvotes: 2

Related Questions