Search code examples
netbeansjarjython

Package Jython app as JAR in Netbeans


We are currently considering using Netbeans to develop a Jython application and I am in the process of evaluating Netbeans' features.

It appears that creating a Jython application is trivial in Netbeans once the Python and Jython modules are installed. Yet I couldn't find a feature which would let we wrap my Jython app as a JAR file with all its dependencies. Is this possible with Netbeans or with some other IDE or do I need to do this kind of packaging by hand?


Solution

  • Have you tried jump

    http://pypi.python.org/pypi/jump/0.9.7.4

    jump Homepage

    Features :

    • Distributing Jython applications into a single, independent JAR file.
    • Distributing Jython libraries into a single JAR file. [New in v0.9.5]
    • Distributing native Mac OS X application bundles, Windows .exe executables, WAR files for Python WSGI applications. [New in v0.9.5]
    • Distributing Java Only applications. [New in v0.9.6]
    • Creating build.xml file for ant. [New in v0.9.7]
    • Supporting Java source code and third-party JAR files.
    • Supporting Java Native Interface files for distributing JAR files. [New in v0.9.5]
    • Starting the created distribution from either Jython or Java code.
    • Including specified resource files in the final distribution. [New in v0.9.6]
    • Packaging only required Python packages into the final distribution automatically, which means you don't have to worry about using Python third-party libraries as long as they can be found in your sys.path.
    • Importing specified Python packages explicitly. [New in v0.9.5]
    • All Python modules included in the final distribution are compiled to $py.class files, which means your source code is not public.
    • Integrated easy use Jython factory. [New in v0.9.7]

    Quick-start Guide


    There is also a info in the jython-wiki (not jump related)

    In brief:

    1. Jar file: run jump jar --main-entry-point=file:main (where file is the name of the Python script file and main is the application's main method/entry point
    2. WAR file: run jump war --main-entry-point=file:main --war-wsgi-handler=...

    The various options available for jump can be shown by outputting help/usage information: run jump --help.