Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1091487
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:32:07+00:00 2026-05-16T23:32:07+00:00

I have a python app and java app. The python app generates input for

  • 0

I have a python app and java app. The python app generates input for the java app and invokes it on the command line.

I’m sure there must be a more elegant solution to this; just like using JNI to invoke C code from Java.

Any pointers?
(FYI I’m v. new to Python)

Clarification (at the cost of a long question: apologies)
The py app (which I don’t own) takes user input in the form of a number of configuration files. It then interprits these and farms work off to a number of (hidden) tools via a plugin mechanism. I’m looking to add support for the functionality provided by the legacy Java app.

So it doesn’t make sense to call the python app from the java app and I can’t run the py app in a jython environment (on the JVM).

Since there is no obvious mechanism for this I think the simple CL invocation is the best solution.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T23:32:08+00:00Added an answer on May 16, 2026 at 11:32 pm

    Sorry to ressurect the thread, but there was no accepted answer…

    You could also use Py4J. There is an example on the frontpage and lots of documentation, but essentially, you just call Java methods from your python code as if they were python methods:

    >>> from py4j.java_gateway import JavaGateway
    >>> gateway = JavaGateway()                        # connect to the JVM
    >>> java_object = gateway.jvm.mypackage.MyClass()  # invoke constructor
    >>> other_object = java_object.doThat()
    >>> other_object.doThis(1,'abc')
    >>> gateway.jvm.java.lang.System.out.println('Hello World!') # call a static method
    

    As opposed to Jython, Py4J runs in the Python VM so it is always “up to date” with the latest version of Python and you can use libraries that do not run well on Jython (e.g., lxml). The communication is done through sockets instead of JNI.

    Disclaimer: I am the author of Py4J

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Google App Engine supports both Python and Java application development. Can I have both
I have a python app which is supposed to be very long-lived, but sometimes
I have a small python app running via uwsgi with requests served by nginx.
I have a Python 2.6 web app built on Pylons 0.9.7. The code in
I have a Python Facebook project hosted on Google App Engine and use the
So I have a python webapp on Google App Engine and am using the
I have a python daemon running as a part of my web app/ How
I want to have multiple pages in google-app engine (python 2.7) and the followoing
Story: One of the app that i have works on python 2.4 and other
I'm currently porting my GAE app to Python 2.7 and have come across some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.