JAVA program running in Windows and Linux

Source: Internet
Author: User
For JAVA programs running in Windows and Linux systems-general Linux technology-Linux programming and kernel information, see the following for details. Recently, a project was created. The customer asked to write a bat file that can be run directly in the window and run in Linux. Of course, it is impossible to use a bat file in Linux. The customer is also engaged in development. He just outsourced a part of it for us to do it. Maybe they think that HttpUnit is not as good as outsourcing computing. Writing bat in Window is very easy to run. It is OK as long as the DOS operation can be successful. I am a newbie and have not learned JAVA too deeply. Many packages need to be added during the operation, I won't even rely on it. Then I tested N and got it done by me.

In the JAVA command-classpath is the import package. If a project needs to contain other packages, you can write: "java-classpath .;.. \ lib \ XXX. 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 the package and package are"; "in Windows, while": "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.

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.