A couple of emails later to the folks at inline@perl.org and some poking around of my own I found the solution. Part A is to make sure the class path gets set correctly and includes not only the jar that I want to use but anything the jar references.

Secondly, just because I've got the class path correct does not mean that it will totally understand the object that you are calling in. Use the study export from Inline::Java to cause it to "study" the object and bind it to Perl.

The end result code looks like:

#!/usr/bin/perl -w BEGIN { my $libdir='/home/pberghol/src/www.bayshoredogclub.org/WebRoot/WEB +-INF/lib'; my @jars=(); opendir LIBDIR,$libdir or die $1; while( my $fname = readdir(LIBDIR)){ next unless $fname =~ m@\.jar$@; push @jars,$libdir . "/" . $fname; } $ENV{CLASSPATH}=join(":",@jars,"/home/pberghol/tmp/bcdchbm.jar"); } use Inline Java => << 'End_Of_Java_Code' ,CLASSPATH=> $ENV{CLASSPATH}; import org.bcdc.hbm.services.PeopleService; class FooBar { public FooBar(){ } public PeopleService getPersonService() { return PeopleService.getInstance(); } } End_Of_Java_Code use Inline::Java qw(study_classes); use Data::Dumper; study_classes(['org.bcdc.hbm.services.PeopleService']); my $foo = new FooBar(); my $psvc = $foo->getPersonService(); print Dumper($psvc); printf "%s\n",$psvc->getPersonNameFromID(1); print Dumper($foo);
Now if I could only remember why I started down this path... Eh... need more coffee.


Peter L. Berghold -- Unix Professional
Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg

In reply to SOLUTION (was Re: Inline::Java and jar files?) by blue_cowdawg
in thread Inline::Java and jar files? by blue_cowdawg

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.