Java Packaged executable jar package contains external files

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.