Click here to Skip to main content
12,447,786 members (64,341 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: Java Perl
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 9-Jan-11 20:23pm
Updated 9-Jan-11 21:30pm
v2

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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
  Permalink  
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)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.160811.3 | Last Updated 10 Jan 2011
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100