Gargi,
To do this you will need install Inline::Java. Get it from CPAN (http://www.cpan.org/modules/by-module/Inline/), along with its dependencies (Inline, Digest::MD5, Parse::RecDescent). The Inline::Java documentation caontains a lot of examples on how to use it, but basically, once you have installed all the modules, you do something like this: use Inline Java => <<'END_OF_JAVA_CODE' ; class Pod_alu { public Pod_alu(){ } public int add(int i, int j){ return i + j ; } public int subtract(int i, int j){ return i - j ; } } END_OF_JAVA_CODE my $alu = new Pod_alu() ; print($alu->add(9, 16) . "\n") ; # prints 25 print($alu->subtract(9, 16) . "\n") ; # prints -7 You can also "study" existing classes like this: use Inline ( Java => 'STUDY', STUDY => ['java.util.HashMap'], ) ; my $hm = new java::util::HashMap() ; $hm->put("key", "value") ; my $val = $hm->get("key") ; print($val . "\n") ; # prints value Good luck, Patrick >From: Gargi Shami <[EMAIL PROTECTED]> >To: [EMAIL PROTECTED] >Subject: how to use inline >Date: Thu, 21 Feb 2002 16:49:12 +0530 > >Hi All, > >I want to call java classes from my perl program . Can anybody provide me >with the exact syntax. > >Regards >Gargi ---------------------------------- | Patrick LeBoutillier | [EMAIL PROTECTED] _________________________________________________________________ Join the world�s largest e-mail service with MSN Hotmail. http://www.hotmail.com
