& 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.