1

I have written a java class

public class Uploadfiles {

    public static void main(String[] args) throws InterruptedException {
        System.out.println(args[0]);
        //uploadFile(args[0]);
    }

I have converted it to jar by right click project>Export> Runable jar> Package required libraries into generated Jar. I have run the command to execute through command line

java -classpath JavaSeleniumLibs.jar javaSeleniumClasses.Uploadfiles Test

The output is

Test

I wanted to run the same commandline script through python and i use the method below

import os
def runCommandline():
    print os.system("java -classpath JavaSeleniumLibs.jar javaSeleniumClasses.Uploadfiles Test")

I wanted the output "Test" to be printed as when done from commandline. How to do it? How to return value from the executed Java function? like "The script is successfully executed"? Can I return other objects from the java function to the python os.system command?

JCDani
  • 307
  • 7
  • 20

0 Answers0