-D ?

Tom Tromey tromey@redhat.com
Tue Apr 23 14:39:00 GMT 2002


>>>>> "Akos" == akos szalay <akos.szalay@sophos.com> writes:

Akos> What does the -D switch do ?
>From the manual:

 @item -D@var{name}[=@var{value}]
 This option can only be used with @code{--main}. It defines a system
 property named @var{name} with value @var{value}. If @var{value} is not
 specified then it defaults to the empty string. These system properties
 are initialized at the program's startup and can be retrieved at runtime
 using the @code{java.lang.System.getProperty} method.
The manual ought to be online somewhere, but to be honest I've never
checked.
Akos> In the help it says "-D<macro> Define a <macro> with string '1'
Akos> as its value", which is what I need, but when using it, I get an
Akos> error "can't specify '-D' without '--main'.
Yes. You're reading the definition for C/C++, which is different.
Java doesn't have macros, so that definition of -D makes no sense for gcj.
Akos> I try to compile together java and c code by using JNI (which
Akos> works just fine in the version from 17/12/2001 - in 3.0.4 it
Akos> seems to be broken). So what does the -D switch do, and what
Akos> should I use instead to define a macro ?
If you're compiling C code you should invoke `gcc'. If you're
compiling C++ you should invoke `g++'. Both of these will accept -D
in the way you expect. gcj should only be used for compiling Java
code (either .java, .class, or resource files with --resource).
Akos> BTW, any estimation on the release of 3.1 ?
Soon, as soon as the critical bugs are fixed. A prerelease came out
today.
Tom


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /