0

Let's say I have a variable in Python called test_text and is equal to "hello" I want to be able to use that inside a separate Java file using System.out.println(text_test);

I have worked with Java and Python both but not together. I am not sure where to start, I have heard of JPython though, but I would like opinions for my specific request.

Python:

test = "hello"

Java:

System.out.println(test);

Thank you! I need to send data from a Python script to a Java file.'

OR:

Suggest a good language to create a GUI application with good support for Python

  • Depending on the application requirements, you can use any of the integration patterns https://en.wikipedia.org/wiki/Enterprise_Integration_Patterns – Sully Feb 10 '19 at 00:47

1 Answers1

0

Depending on how big of a system you are working on, you might consider a messaging queue like RabbitMQ.

You would send messages between a Python and Java, and do actions in one of them whenever there are messages available.

You can also go to a lower level and work with something like Redis (in-memory DB), like this answer to a similar question.

Yet, another alternative is to communicate between them as micro services. Where each one exposes an API, say, standard http restful API. On the Python side I'd go for Flask-RESTPlus, but on the Java side I'm unsure, some time since I used it last.

André C. Andersen
  • 8,955
  • 3
  • 53
  • 79
  • So there isn't a simple way to do this? Is it easier with other languages? I know it sounds like I'm trying to find an easy way out, but I want to learn Python but another one that works well with it. I have a 1300 line Python application, but want a new language. –  Feb 10 '19 at 00:54