#604 #490 add java.se.ee to application at runtime. (#605)

This commit is contained in:
Scott Fennell 2018-04-23 17:10:49 -05:00 committed by jmpenn
parent f412125715
commit ba2df0757e

View File

@ -1,11 +1,11 @@
#!/usr/bin/perl #!/usr/bin/perl
package launch_java ; package launch_java ;
@ISA = qw(Exporter); @ISA = qw(Exporter) ;
@EXPORT = qw(launch_java); @EXPORT = qw(launch_java) ;
# launch_java determines trick_home based on execution location of the calling script. # launch_java determines trick_home based on execution location of the calling script.
use File::Basename ; use File::Basename ;
use Cwd 'abs_path'; use Cwd 'abs_path' ;
use gte ; use gte ;
sub launch_java($$) { sub launch_java($$) {
@ -27,6 +27,10 @@ sub launch_java($$) {
} }
$java_dir = "$ENV{TRICK_HOME}/$lib_dir/trick/java" ; $java_dir = "$ENV{TRICK_HOME}/$lib_dir/trick/java" ;
$javac_version = `javac -version 2>&1` ;
$javac_version =~ /(\d+)/ ;
$javac_version = $1 ;
$host_cpu = gte("TRICK_HOST_CPU") ; $host_cpu = gte("TRICK_HOST_CPU") ;
chomp($host_cpu) ; chomp($host_cpu) ;
$ENV{TRICK_HOST_CPU} = $host_cpu ; $ENV{TRICK_HOST_CPU} = $host_cpu ;
@ -35,18 +39,23 @@ sub launch_java($$) {
$command = "java -classpath $java_dir/dist/*:$java_dir/lib/*:$java_dir/lib/ \\ $command = "java -classpath $java_dir/dist/*:$java_dir/lib/*:$java_dir/lib/ \\
-Xdock:name=\"$name\" \\ -Xdock:name=\"$name\" \\
-Xdock:icon=$java_dir/resources/trick_icon.png \\ -Xdock:icon=$java_dir/resources/trick_icon.png \\
-Djava.net.preferIPv4Stack=true \\ -Djava.net.preferIPv4Stack=true \\" ;
$application" ;
} else { } else {
$command = "java -cp $java_dir/dist/*:$java_dir/lib/*:$java_dir/lib/ $application" ; $command = "java -cp $java_dir/dist/*:$java_dir/lib/*:$java_dir/lib/ \\" ;
} }
if ( ($javac_version eq "9") or ($javac_version eq "10") ) {
$command .= "
--add-modules java.se.ee \\" ;
}
$command .= "
$application" ;
foreach (@ARGV) { foreach (@ARGV) {
$command .= " $_"; $command .= " $_" ;
} }
system $command ; system $command ;
exit $? >> 8; exit $? >> 8 ;
} }
1; 1 ;