Python Forum
How to run python code in Java using remote SSH without py file using streams in Java
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to run python code in Java using remote SSH without py file using streams in Java
#1
How to run python code in Java using remote SSH without py file using streams in Java?
How to pass arguments in such a case?

let's say I have to connect to a device using SSH. I get the code from the database instead of storing code in a file. Now I use Java Streams to run the code in exec mode all at once. I ask the user to give the output in a specified JSON format. In this scenario, I want to send arguments to the code. But I am not so sure how to do it.
More importantly, this has to work for non-Linux devices where python prompt might not be available but you can SSH to the CLI where you can run certain commands. In this case, you are not sure of the location to say for example, /usr/bin/python is where the code should be executed after connecting to the target device through SSH.
Here is the example code www.jcraft.com/jsch/examples/Exec.java.html but for me there is no such UI / user interaction. It has to be done at one go.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Triggering a ps1 script in remote windows server via http python request jasveerjassi 1 319 Jan-26-2024, 07:02 PM
Last Post: deanhystad
  i tried to install python for the first time today and pretty certain im being remote brianlj 2 505 Oct-03-2023, 11:15 AM
Last Post: snippsat
  PsInfo from remote computer in python susja 3 2,224 Oct-10-2022, 08:39 AM
Last Post: DeaD_EyE
  Problem with importing Python file in Visual Studio Code DXav 7 4,911 Jun-15-2022, 12:54 PM
Last Post: snippsat
  Python code to read second line from CSV files and create a master CSV file sh1704 1 2,353 Feb-13-2022, 07:13 PM
Last Post: menator01
Sad SyntaxError: from simple python example file from mind-monitor code (muse 2) warmcupoftea 4 2,751 Jul-16-2021, 02:51 PM
Last Post: warmcupoftea
  Request for Python code - Features extraction from JSON file (cuckoo) thinker 1 2,147 Apr-07-2021, 04:40 PM
Last Post: Larz60+
  issue with Tabula-py, pyinstaller and java maurom82 2 3,125 Feb-19-2021, 04:32 PM
Last Post: buran
  Remote File Transfer- Error wonderboy 1 1,653 Jan-06-2021, 11:24 AM
Last Post: wonderboy
  Skeleton file export error Python Code pepapoha 4 3,427 Nov-17-2020, 02:06 AM
Last Post: pepapoha

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020