Call a java class from perl

I would like to call a java class from perl. I usually use the java class from command line to do some processing like:

java com.something.some

Now, I need to call it from inside a perl script.

Could you let me know how I can do it?


This is simple enough - you just use the system command to execute an arbitrary command line, e.g.

system("java com.something.Some")

The Java library lets you to easily integrate Java calls in Perl code.


use Java;
$java = new Java;
$obj = $java->create_object("","constructor parameter");
$obj->myMethod("method parameter");

Inline::Java is a well known module for Java/Perl integration. It simplifies embedding Java in Perl code as well as the converse: embedding Perl into Java.

View the Cpan perldoc for more information on how to use this module.

Need Your Help

session_start seems to be very slow (but only sometimes)

php apache session debian fastcgi

For some odd reason, just today our server decided to be very slow during the starting of sessions. For every session_start, the server either times out after 30 seconds, or it'll take about 20 sec...