将python(“.py”)文件与用于Web应用程序的java类文件捆绑在一起 [英] Bundling python(".py")files along with java class files for a web application

查看:373
本文介绍了将python(“.py”)文件与用于Web应用程序的java类文件捆绑在一起的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用一个java我们的应用程序,其中flex是前端,我们使用Axis2进行Web服务。所以,对于服务的java代码,我们将java类作为aar文件捆绑并提供给flex2与flex2交互的轴。

We are having an java we application where flex is front end and we use Axis2 for web services.So what ever the java code for services we bundle java classes as an aar file ans supply to axis2 with which flex interacts.

最近我们有一个req,我们需要使用java,Eclipse中的一些python代码,我通过将jython.jar,plyJy.jar添加到lib文件夹来设置并添加了什么src文件夹所需的py文件,我可以在java代码中使用python方法。

Recently we had a req where we need to use some python code from java, So Eclipse, i setup by adding jython.jar,plyJy.jar to the lib folder and added what ever the py files needed to the src folder and i was able to use python methods in the java code.

PySystemObjectFactory factory = new PySystemObjectFactory(ApplicationContext.class, "cs", "ApplicationContextInst");
ApplicationContext appcon = (ApplicationContext)factory.createObject();

但我不知道如何将这些py文件与java文件捆绑在一起。我尝试添加此文件。 py文件直接到aar文件。但它在尝试创建PySystemObjectFactory对象实例时失败。

But i am not sure how to bundle this py files along with java files.i tried adding this .py files directly to the aar file.But it fails when it tried to create the PySystemObjectFactory Object Instance.

任何帮助都将受到高度赞赏。

Any help would be highly appreciated.

推荐答案

http://mavenjython.sourceforge.net/ 。它允许将带有依赖项的jython捆绑到一个独立的jar中。

Have a look at the maven-jython-compile-plugin and its demo project at http://mavenjython.sourceforge.net/ . It allows bundling jython with dependencies into a standalone jar.

这篇关于将python(“.py”)文件与用于Web应用程序的java类文件捆绑在一起的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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