View Full Version : How to call Java class methods from Perl?

01-20-2010, 10:55 PM
I need to call a Java class method from within Perl code. The Inline method is not a good choice for me since the Java method is big and it's populating a few database tables. How can I do this? Thanks.

01-21-2010, 12:58 AM
I don't work with Java, but a quick cpan search came up with this:

Java::Import - Use Java classes in Perl

Java::Import::Examples - Example of how to use Java::Import to call into Java classes


01-22-2010, 05:42 PM
Thank you for the links. They are certainly helpful. I just have one other question and that is if the Java code is on the same machine as the Perl code, what do I need to set (environment variables, path, ...) on that machine? Thanks.

01-22-2010, 06:04 PM
Since I don't work with Java, I can't say what env vars and paths it needs. You may need to ask that in the Java forum.

Within Perl, you set environment vars via Perl's %ENV hash.