简体   繁体   中英

Calling Java methods and classes from Perl script

I have a quite huge Java class that has several imported packages and libraries (related to natural language processing). I want to call some specific methods of my Java classes and get results back using a Perl script. How should I do this? I guess the Inline::Java is not suitable for my purpose since the Java code is quite large to be incorporated at one place.

Why is Inline::Java not suitable? You don't need to provide access to all the bits of your Java API. You can write short methods that call into your Java stuff. A small Java adapter layer can show up in your Perl code to give you the access you need. Have you tried it yet?

How big is this Java code base? I've been on projects that easily integrated big Java SDKs (although I wasn't that one doing that part).

I had ran into similar situation lately. The best solution which worked for me was to use apache thrift service and expose the required methods through it. These method were then in turn consumed by the client written in perl.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM