Use Java to call the executable command

xiaoxiao2021-03-05  29

Package test; / *** Add one senence class summary here. * Add class description herE. ** @Author lxx * @version 1.0, 2004-11-16 * / public class testcmd {public testcmd () {} / * public Void main (string args []) {try {process = runtime.getRuntime (). EXEC ("cmd.exe / c start http://www.9cbs.net"); // Login Website Process Process = Runtime. GetRuntime (). EXEC ("cmd.exe / c start ping 10.144.98.100"); // calls ping command} catch (exception e) {E.PrintStackTrace ();}}} * /// Established Public static void main (String [] args) {system.out.println ("User.Dir"); CreateFolder ("Hello"); CreateFolder ("Hello");} princendelname ) {String Temp = system.getProperty ("user.dir") java.io.file.seParetor foldername; java.io.file f = new java.io.file (temp); f.mkdirs ();}} Get the path java.io. *; Public class test {public static in the Java program Void main (string [] args) {file directory = new file ("."); try {file newpath = new file (directory.getcanonicalPath () "newfolder"); newPath.mkdir ();} catch (Exception Exp ) {Exp.printStackTrace ();}}} // file Directory = new file ("."); // Directory.getcanonicalPath (); get the current path to call ping command in the JSP page --- pingip.jsp <% @ Page language = "java" contenttype = "text / html; charset = GB2312" Import = "java.io. *"%>

转载请注明原文地址:https://www.9cbs.com/read-33824.html

New Post(0)