Mahesh,

Two things here:

1- Perl will not expand variables in single quoted (') strings (use double
quotes ("))
2- The 'use Inline...' construct is evaluated at compile time, so you must
initialize
    your variables using a BEGIN block.

This works:

-------------------------------------------------
BEGIN {
    $main::CNOTE_HOME = "/bla/bla/bla"
}

use Inline (Java  => 'DATA',
    PORT => 4500,
    EXTRA_JAVA_ARGS => "-Xmx196m -DCNOTE_HOME=$main::CNOTE_HOME"
);

print test->get_prop("CNOTE_HOME"), "\n" ;

__END__
__Java__
class test {
    public static String get_prop(String p){
        return System.getProperty(p) ;
    }
}
-------------------------------------------------
[EMAIL PROTECTED] Inline-Java]$ perl -Mblib bug/test.pl
/bla/bla/bla


Patrick


> Hi,
> I am trying to use -D option as my Java code does
> System.getProperty("CNOTE_HOME").
>
>         use Inline (Java  => 'STUDY',
>                 J2SDK => '$CNOTE_HOME/tools/java',
>                 STUDY => [],
>                 PORT => 4500,
>                 EXTRA_JAVA_ARGS => '-Xmx196m -DCNOTE_HOME=$CNOTE_HOME'
>                 );
>
> With the above usage, -DCNOTE_HOME doesnot seem to work.\
>
> I.e. inside the Java program, System.getProperty("CNOTE_HOME") yields
> "null" when
> -Xmx196m is taking effect as expected.
>
> Is that -D option will not work with EXTRA_JAVA_ARGS field ?
>
> Please share with me any pointers/suggestions what is wrong here ?
>
> Thanks,
> Mahesh
>
>

Reply via email to