The external file is set in the program relative to the current project path, and when the jar package is executed, the external file is placed in the directory with the Jar Kanehira level.
1 Public classMain {2 34 Public Static voidMain (string[] args)throwsIOException, interruptedexception {5 6String a=args[0];7 8String b=args[1];9 TenString c=args[2]; One AString[] Cmd=NewString[3]; - -cmd[0]= "Python"; the -cmd[1]= "testpython.py"; - -System.out.println (A + "" +b+ "" +c); + -System.out.println ("Start"); + AProcess proc =runtime.getruntime (). exec (cmd); at -BufferedReader in=NewBufferedReader (NewInputStreamReader (Proc.getinputstream ())); - - String Line; - - while((Line=in.readline ())! =NULL){ in - System.out.println (line); to + } - the in.close (); * $ proc.waitfor ();Panax Notoginseng -System.out.println ("End"); the + } A the}
Execute the executable jar command at the command line Java-jar Hello.jar
Java Packaged executable jar package contains external files