Subject: | Cannot use wildcards in CLASSPATH |
Inline-Java-0.53
This is perl, v5.10.1 (*) built for x86_64-linux-thread-multi
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)
I am trying to access an Oracle library that is spread among a list of jar files. When I specify my CLASSPATH => '/home/oracle/oimclient/lib/*', the current module rejects that path because it does not pass the '-e' test. If I specify the directory, without the wildcard, as '/home/oracle/oimclient/lib/' it gets included in the path, but then the java compiler does not look for the jar files in that directory.
I can fix this problem two ways.
1) Explicitly list out each jar file in the class path. This works, and is probably safer coding.
2) Patch the Java::Portable::make_classpath() code to look for wildcard directory entries and keep them in the passed CLASSPATH. The attached patch is my solution for this.
Subject: | wildcard_classpath.patch |
diff -uNr Inline-Java-0.53.orig/Java/Portable.pm Inline-Java-0.53/Java/Portable.pm
--- Inline-Java-0.53.orig/Java/Portable.pm 2011-01-09 08:16:03.000000002 -0500
+++ Inline-Java-0.53/Java/Portable.pm 2014-02-05 14:12:09.000000002 -0500
@@ -58,7 +58,17 @@
my @fcp = () ;
my %cp = map {$_ => 1} @cp ;
foreach my $p (@cp){
- if (($p)&&(-e $p)){
+ if ($p =~ m{\A(.*)/\*\z}) {
+ my $d = $1;
+ if (($d)&&(-d $d)){
+ my $fp = Inline::Java::Portable::portable("SUB_FIX_JAVA_PATH",
+ File::Spec->rel2abs($d)).'/*';
+
+ Inline::Java::debug(2, "keeping wildcard classpath as '$fp'") ;
+ push @fcp, $fp;
+ }
+ }
+ elsif (($p)&&(-e $p)){
if ($cp{$p}){
my $fp = File::Spec->rel2abs($p) ;
push @fcp, Inline::Java::Portable::portable("SUB_FIX_JAVA_PATH", $fp) ;