Since you have not mentioned how robust your application is I can think of a solution which can be used if you are planning for a higher level architecture.

  1. Create a python based web application (HTTP server) with all logic to process your files.
  2. Create a java app which can communicate via HTTP python server to get the CSV processed information.

Try to avoid Runtime execution of commands with in your codes that faces user as if it not is properly managed there is always a chance for security breach

Answer from Santosh Balaji Selvaraj on Stack Overflow
Discussions

How can I transfer data between Java and Python

What kind of data? And what operating system?

Here is some general reading: https://en.wikipedia.org/wiki/Inter-process_communication

More on reddit.com
🌐 r/learnprogramming
8
1
August 8, 2017
Communication between python client and java server - Stack Overflow
My aim is to send a message from python socket to java socket. I did look out on the resource mentioned above. However I am struggling to make the Python client talk to Java server. Mostly because ... More on stackoverflow.com
🌐 stackoverflow.com
April 21, 2013
Communicate with Java program from Python - Stack Overflow
To interact with the java program, simply call communicate() with no arguments. More on stackoverflow.com
🌐 stackoverflow.com
May 26, 2017
Both ways, java <=> python, communication using py4j - Stack Overflow
I am using py4j for communication between python and java.I am able to call python method from java side. But from python I am not able to send any object or call java method. Here is the code i have More on stackoverflow.com
🌐 stackoverflow.com
🌐
Jacob Jedryszek
jj09.net › interprocess-communication-python-java
Interprocess communication between Python and Java | Jacob Jedryszek
June 12, 2014 - The communication is one direction: from Python app to Java app. Every message is one line of text (ultimately: json format). E.g.: "text\r\n".
🌐
Slideshare
slideshare.net › home › technology › communication between java and python
Communication between Java and Python | PPT
June 4, 2008 - This document discusses various approaches for enabling communication between Java and Python programs, including: 1. Using bindings like JPE and JPI that allow calling Python from Java.
🌐
GeeksforGeeks
geeksforgeeks.org › java › integrating-java-with-python
Integrating Java with Python - GeeksforGeeks
July 23, 2025 - First, the Python program should be able to access the Java Virtual Machine (JVM) running the Java program. This requires an instance of the GatewayServer class available in the library py4j that makes this communication possible. Secondly, an entry point should be mentioned in the call to the constructor of the class GatewayServer.
🌐
Coderanch
coderanch.com › t › 739033 › java › communication-java-client-python-server
communication between a java client and a python server using TLS (Sockets and Internet Protocols forum at Coderanch)
when I try to send something from the server to the client I either receive nothing when I use BufferedReader in java or I receive "null" when I use inputStream I don't receive anything and when I ask an input from the python server side to send it to the client I get this error " TypeError: memoryview: a bytes-like object is required, not 'str'" I really don't know how to solve this problem especially that I don't know much about SSL or encoding.
🌐
Reddit
reddit.com › r/learnprogramming › how can i transfer data between java and python
r/learnprogramming on Reddit: How can I transfer data between Java and Python
August 8, 2017 -

Hello,

I'm concurrently running two separate programs, one in Java and another in Python. I need to get some data from the Java program into the Python one, and I'm not sure how I could do it. My current application wouldn't allow me to use Jython, so other solutions would be pretty cool.

Edit : It's some numerical Data, in Linux

Find elsewhere
Top answer
1 of 5
8

Append \n to the end of data:

client_socket.send(data + '\n')
2 of 5
3

ya..you need to add '\n' at the end of the string in python client..... here's an example... PythonTCPCLient.py

`

#!/usr/bin/env python

import socket

HOST = "localhost"
PORT = 8080

sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((HOST, PORT))

sock.sendall("Hello\n")
data = sock.recv(1024)
print "1)", data

if ( data == "olleH\n" ):
    sock.sendall("Bye\n")
    data = sock.recv(1024)
    print "2)", data

    if (data == "eyB}\n"):
        sock.close()
        print "Socket closed"

`

Now Here's the java Code: JavaServer.java `

 import java.io.*;
import java.net.*;

class JavaServer {
    public static void main(String args[]) throws Exception {
        String fromClient;
        String toClient;

        ServerSocket server = new ServerSocket(8080);
        System.out.println("wait for connection on port 8080");

        boolean run = true;
        while(run) {
            Socket client = server.accept();
            System.out.println("got connection on port 8080");
            BufferedReader in = new BufferedReader(new InputStreamReader(client.getInputStream()));
            PrintWriter out = new PrintWriter(client.getOutputStream(),true);

            fromClient = in.readLine();
            System.out.println("received: " + fromClient);

            if(fromClient.equals("Hello")) {
                toClient = "olleH";
                System.out.println("send olleH");
                out.println(toClient);
                fromClient = in.readLine();
                System.out.println("received: " + fromClient);

                if(fromClient.equals("Bye")) {
                    toClient = "eyB";
                    System.out.println("send eyB");
                    out.println(toClient);
                    client.close();
                    run = false;
                    System.out.println("socket closed");
                }
            }
        }
        System.exit(0);
    }
}

` Reference:Python TCP Client & Java TCP Server

🌐
Ijarcce
ijarcce.com › papers › using-py4j-for-java-python-communication
Using Py4J for Java-Python Communication | Peer-reviewed Journal
May 31, 2023 - This means that the Python script ... Python and Java, allowing Python to access Java classes and methods. Py4J is a Python module that enables Python programs to communicate with Java applications....
🌐
GitHub
github.com › a-asaker › socket-python-java
GitHub - a-asaker/socket-python-java: One Way Communication Using Socket Programming, Java And Python
Commnuicate Between Java And Python Using Sockets. One Way Communication, The Client Sends To The Server.
Author   a-asaker
🌐
Medium
medium.com › @jj09 › interprocess-communication-between-python-and-java-575da9f277f5
Interprocess communication between Python and Java | by Jacob Jedryszek | Medium
May 19, 2016 - The communication is one direction: from Python app to Java app. Every message is one line of text (ultimately: json format).
🌐
DLR Electronic Library
elib.dlr.de › 59394 › 1 › Mixing_Python_and_Java.pdf pdf
Mixing Python and Java
How Python and Java can communicate · and work together · EuroPython 2009 (June 30th 2009, Birmingham) Andreas Schreiber <Andreas.Schreiber@dlr.de> German Aerospace Center (DLR), Cologne, Germany · http://www.dlr.de/sc · Folie 2 · EuroPython 2009 > Andreas Schreiber > Mixing Python and ...
🌐
Quora
quora.com › What-is-the-best-way-to-use-Python-and-Java-together
What is the best way to use Python and Java together? - Quora
Answer (1 of 6): I like to keep projects to a single language per execution environment to avoid the cost of context switching. Java, as a JVM language, can call code written in other languages; the bulk of my experience with this is calling Scala code from Java while working on a big Play! frame...
🌐
Python
mail.python.org › pipermail › tutor › 2005-January › 034909.html
[Tutor] communication between java and python?
January 14, 2005 - On Thu, 13 Jan 2005, joeri honnef wrote: > I'm trying to communicate between Python and Java and using os.popen(). > But thing dont work...The Java program reads strings from stdin and the > python program just writes to stdout. Hi Joeri, You may want to look at: http://www.python.org/doc/lib/popen2-flow-control.html which explains some of the tricky flow-control issues that can happen during inter-process communication.
🌐
Stack Overflow
stackoverflow.com › questions › 44149878 › both-ways-java-python-communication-using-py4j
Both ways, java <=> python, communication using py4j - Stack Overflow
# Then execute: java -cp py4j.jar py4j.examples.SingleThreadClientApplication from py4j.java_gateway import JavaGateway, CallbackServerParameters simple_hello = SimpleHello() gateway = JavaGateway( callback_server_parameters=CallbackServerParameters(), python_server_entry_point=simple_hello) ... Can you be more specific about your problem? What do you mean by "not able to send"? What have you tried so far? ... If you were able to receive "From python to ...", the Python process can definitively communicate with the Java side.
🌐
Reddit
reddit.com › r/java › best way to combine python and java?
r/java on Reddit: Best way to combine Python and Java?
October 29, 2022 -

My project uses some packages that are available only in Python and heavily rely on C libraries. The project also greatly benefits from Java libraries and the JVM. What's the optimal way to call Python functions from Java?

I tried:

  1. Small web-services: overhead to serialize data, start and stop the services. Also debugging is harder and implementing each new function is now double the effort.

  2. Jpy: a library that runs an interpreter in the JVM. Spare the service start/stop, but: isn't really feasible for more than a single-liner, data translation between Java and Python is cumbersome, and I also encountered runtime segmentation fault errors.

Any other options?

The project is in the machine-learning domain, so involves exchanging large numeric arrays and text. In some cases the execution switches back and forth between the platforms.

🌐
Mecs-press
mecs-press.org › ijitcs › ijitcs-v15-n4 › v15n4-5.html
Implementation of Python Interoperability in Java through TCP Socket Communication
The importance of interoperability and cross-language communication between Java and Python via socket programming is examined in this research article through an empirical model of different execution environment paradigms that can help guide the development of improved approaches for integrating ...