java启动服务示例代码
发布时间:2022-05-20 点击数:860
public static void main(String[] args) { try { String cmd = "net start MySQL57_3306"; logger.info("执行指令==>{}", cmd); Process p = Runtime.getRuntime().exec(cmd); InputStream stderr = p.getErrorStream(); InputStreamReader isr = new InputStreamReader(stderr, Charset.forName("GBK")); BufferedReader br = new BufferedReader(isr); String line = null; while ((line = br.readLine()) != null) logger.info("{}", line); } catch (Exception e) { logger.error("异常", e); } }
上一篇:JavaCV rtsp转图片 下一篇:java文字转语音播报功能的实现方法