Click here to Skip to main content
15,881,089 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have a small Java code which I exported to a .jar file.

The .jar file has some methods, one of which is a simple method (that displays a message box). Now, I want to write a perl script that can call this method.

How do I go about this? How do I import the jar file in a Perl script? After importing the jar file, how do I call the method?
Posted
Updated 9-Jan-11 21:30pm
v2

1 solution

One solution is to call your java method from c using jni, and then create a perl wrapper for the c function.

swig[^] may help you getting this done faster.

Update:
You can use Jace[^] to create a c++ wrapper for your java project. Then use swig to create a perl wrapper for the c++ code.

You can always try:
Call Java from Perl
[^] - it will probably work, but I haven't tried it myself.

Regards
Espen Harlinn
 
Share this answer
 
v2
Comments
S.Raaj Nishanth 10-Jan-11 4:05am    
Is there a way to directly call the java method from perl. I'm not very confident about writing a C-program to do this.
S.Raaj Nishanth 11-Jan-11 23:22pm    
Thank you. I think "Call Java from Perl" should do the trick.
Espen Harlinn 12-Jan-11 4:35am    
Nice that I was able to help. Voting and marking the question as answered will be appreciated :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900