Ken,
> I don't think that works, because this is an Error instead of an
> Exception.
Try changing caught("java.lang.Exception") to caught("java.lang.Error") or
caught("java.lang.Throwable") and that should work. In any case if your
sure your dealing with
main::java::lang::NoClassDefFoundError=HASH(0xa594ec),
you can just try [EMAIL PROTECTED]>getMessage()
(In this case $@ contains a "reference" to the actual java.lang.Throwable
object (in your case java.lang.NoClassDefFound) that was thrown by Java)
Cheers,
Patrick
---------------------
Patrick LeBoutillier
Laval, Quebec, Canada
----- Original Message -----
From: "Ken Williams" <[EMAIL PROTECTED]>
To: "Patrick LeBoutillier" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, October 20, 2003 11:11 PM
Subject: Re: NoClassDefFoundError
>
> On Monday, October 20, 2003, at 06:54 PM, Patrick LeBoutillier wrote:
>
> > Ken,
> >
> > This probably means that some code you are using can't find a specific
> > class. Try putting eval around you script like this see what's going
> > on:
> >
> > use Inline::Java qw(caught) ;
> >
> > eval {
> > # ...
> > } ;
> > if ($@){
> > if (caught("java.lang.Exception")){
> > # Java exception...
> > my $msg = [EMAIL PROTECTED]>getMessage() ;
> > print($msg . "\n") ;
> > }
> > else{
> > # It wasn't a Java exception after all...
> > die $@ ;
> > }
> > }
>
> I don't think that works, because this is an Error instead of an
> Exception. Or something. In any case, I tried to use a $SIG{__DIE__}
> to get a stack trace, and it didn't work. I presumed the error wasn't
> trappable.
>
> I'll try it again tomorrow when I'm at work, where the code is.
>
> Let me just make it clear how very awesome Inline::Java is, by the way
> - it means I can do my research using my colleagues' Java libraries and
> I still get to use Perl. =) I'm finding the J/P interface extremely
> well-designed so far, kudos.
>
> -Ken
>
>