从Perl脚本调用Java方法. [英] Calling Java methods from a Perl script.

查看:503
本文介绍了从Perl脚本调用Java方法.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个小的Java代码,我将其导出到.jar文件.

.jar文件包含一些方法,其中一种是简单方法(显示消息框).现在,我想编写一个可以调用此方法的perl脚本.

我该怎么办?如何在Perl脚本中导入jar文件?导入jar文件后,如何调用该方法?

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?

推荐答案

一种解决方案是使用jni从c调用Java方法,然后为c函数.

swig [ ^ ]可以帮助您更快地完成此任务.

更新:
您可以使用 Jace [从Perl调用Java
[ ^ ]-它可能会起作用,但我自己还没有尝试过.

问候
Espen Harlinn
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


这篇关于从Perl脚本调用Java方法.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆