Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Feb 2009
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question How to call Java class methods from Perl?

    Hi,
    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.

  • #2
    Super Moderator
    Join Date
    May 2005
    Location
    Southern tip of Silicon Valley
    Posts
    2,874
    Thanks
    2
    Thanked 164 Times in 159 Posts
    I don't work with Java, but a quick cpan search came up with this:

    Java::Import - Use Java classes in Perl
    http://search.cpan.org/~rusekd/Java-...Java/Import.pm

    Java::Import::Examples - Example of how to use Java::Import to call into Java classes
    http://search.cpan.org/~rusekd/Java-...a/Examples.pod

    http://search.cpan.org/search?query=java&mode=all

  • #3
    New Coder
    Join Date
    Feb 2009
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #4
    Super Moderator
    Join Date
    May 2005
    Location
    Southern tip of Silicon Valley
    Posts
    2,874
    Thanks
    2
    Thanked 164 Times in 159 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •