Changeset 12848


Ignore:
Timestamp:
2006-09-26T14:22:03+12:00 (18 years ago)
Author:
nzdl
Message:

try the JAVA_HOME variable first to find java, otherwise just use 'java' [kjdon]

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/bin/script/lucene_query.pl

    r12770 r12848  
    3636use util;
    3737
    38 
    3938my $PROGNAME = $0;
    4039$PROGNAME =~ s/^.*\/(.*)$/$1/;
    4140
     41
     42sub get_java_path()
     43{
     44    # Check the JAVA_HOME environment variable first
     45    if (defined $ENV{'JAVA_HOME'}) {
     46    my $java_home = $ENV{'JAVA_HOME'};
     47    $java_home =~ s/\/$//;  # Remove trailing slash if present (Unix specific)
     48    return &util::filename_cat($java_home, "bin", "java");
     49    }
     50
     51    # Hope that Java is on the PATH
     52    return "java";
     53}
    4254
    4355sub open_java_lucene
     
    5264    my $out_file = shift(@_);
    5365
     66    my $java = &get_java_path();
    5467    my $classpath = &util::filename_cat($ENV{'GSDLHOME'}, "bin", "java", "LuceneWrap.jar");
    55     my $java_lucene = "java -classpath \"$classpath\" org.nzdl.gsdl.LuceneWrap.GS2LuceneQuery";
     68    my $java_lucene = "$java -classpath \"$classpath\" org.nzdl.gsdl.LuceneWrap.GS2LuceneQuery";
    5669
    5770    my $cmd = "| " . $java_lucene . " \"" . $full_indexdir . "\"";
Note: See TracChangeset for help on using the changeset viewer.