How to run JAVA programs in Windows and Linux

Source: Internet
Author: User
& Nbsp; how can I write a bat program that can be run directly in the window and run in Linux? This requires the help of JAVA. In the JAVA command-classpath is the import package. if a project needs to contain other packages, you can write: java-classpath... libXXX. jar; javafilename,  

How can I write a bat that can be run directly in the window and run in Linux? This requires the help of JAVA.

In the JAVA command-classpath is the import package. if a project needs to contain other packages, you can write: "java-classpath .;.. libXXX. jar; javafilename ", which is a command statement in Windows. do not forget".; ". Written in Linux: "java-classpath :. /lib/XXX. jar javafilename ". if no environment variable is configured, you can change java to an absolute path, that is, the JDK installation bin path: % JavaHome %/bin/java. here there is no".; ", and between the package and the package, the"; "is used in Windows, while": "is used in Linux. remember"/"in Linux and do not write it as" "by mistake. Save the command statement as bat or sh and double-click the corresponding system to run it.

In addition, run the SH file command: sh shname. sh in the Linux console to view the file content: vi filename. filetype.

Related Article

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.