Numerous changes to bring things back into sync with the modern Narya

state of affairs.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@754 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
mdb
2002-05-21 04:45:10 +00:00
parent dc4ef96d4e
commit 18cf7f6763
16 changed files with 462 additions and 261 deletions
+28 -16
View File
@@ -1,12 +1,8 @@
#!/usr/bin/perl -w
#
# $Id: runjava,v 1.1 2001/10/09 20:27:35 mdb Exp $
#
# Invokes java with the necessary classpath and parameters.
use Getopt::Std;
my $usage = "Usage: $0 [-p pid_file] [-r server_root] args\n";
my $usage = "Usage: $0 [-p pid_file] [-r root_directory] args\n";
# locations of stuff
chomp($location = `dirname $0`);
@@ -16,8 +12,9 @@ chomp($location = `dirname $0`);
pop(@parts);
my $root = join("/", @parts);
# make sure JAVA_HOME is set
my $jhome = $ENV{"JAVA_HOME"};
# make sure JAVA_HOME is set
if (!defined $jhome) {
warn "$0: Error: No JAVA_HOME specified!\n";
warn "\n";
@@ -55,22 +52,32 @@ if (defined $libpath) {
}
# put everything in our class path
my $classpath = "-classpath $jlib:$root/dist/classes";
my $classpath = "-classpath $root/dist/classes";
# any zip or jar files in our lib/ directory get added to the class path
if (opendir(DIR, "$root/lib")) {
foreach $lib (grep { /.(zip|jar)/ && -f "$root/lib/$_" } readdir(DIR)) {
$classpath .= ":$root/lib/$lib";
# add zip and jar files from our lib/ directory and the system lib/ directory
my @dirs = ( "$root/lib", $ENV{"JAVA_LIBS"} );
foreach $dir (@dirs) {
next unless (defined $dir);
if (opendir(DIR, $dir)) {
foreach $lib (grep { /.(zip|jar)/ && -f "$dir/$_" } readdir(DIR)) {
$classpath .= ":$dir/$lib";
}
closedir DIR;
}
closedir DIR;
}
# finally add the standard classes
$classpath = "$classpath:$jlib";
# specify our application root (the resource manager needs this)
my $rootarg = "-Dresource_url=file:$root/rsrc";
my $pid_file = undef;
my $i = 0;
# strip out the args (we'd use getopt() but the damned thing provides no
# way of escaping arguments so that we can pass args to runjava that get
# passed down to the JVM)
# strip out the -p and -r args (we'd use getopt() but the damned thing
# provides no way of escaping arguments so that we can pass args to
# runjava that get passed down to the JVM)
for ($i = 0; $i < @ARGV; $i++) {
my $arg = $ARGV[$i];
@@ -84,12 +91,17 @@ for ($i = 0; $i < @ARGV; $i++) {
$pid_file = $ARGV[$i+1];
splice(@ARGV, $i, 2);
$i -= 1; # decrement i so that things stay in sync
} elsif ($arg eq "-r") {
$rootarg = "-DDapplication.root=" . $ARGV[$i+1];
splice(@ARGV, $i, 2);
$i -= 1; # decrement i so that things stay in sync
}
}
# log the pid file if requested to do so
print `echo $$ > $pid_file` if (defined $pid_file);
my $cmd = "$java $classpath " . join(" ", @ARGV);
my $cmd = "$java -mx256M $classpath $rootarg " . join(" ", @ARGV);
# print "$cmd\n";
exec($cmd);