Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: Java Perl
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
Edited 9-Jan-11 21:30pm

1 solution

Rate this: bad
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.
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.
Espen Harlinn
S.Raaj Nishanth at 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 at 11-Jan-11 23:22pm
Thank you. I think "Call Java from Perl" should do the trick.
Espen Harlinn at 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
0 _Amy 310
1 OriginalGriff 294
2 Nirav Prabtani 268
3 Sergey Alexandrovich Kryukov 211
4 CHill60 150
0 OriginalGriff 7,889
1 Sergey Alexandrovich Kryukov 7,006
2 Maciej Los 4,014
3 Peter Leow 3,708
4 CHill60 2,762

Advertise | Privacy | Mobile
Web03 | 2.8.140721.1 | Last Updated 10 Jan 2011
Copyright © CodeProject, 1999-2014
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