我的来源在下面
<%@ page language="java"
import= "java.io.*,java.util.*"
contentType="text/html;charset=EUC-KR" session="false"
%>
<html>
<%
try{
Process ps = null;
ps = Runtime.getRuntime().exec(new String[]{"su","ec2-user"});
ps.waitFor();
ps = Runtime.getRuntime().exec(new String[]{"cd"});
ps.waitFor();
ps = Runtime.getRuntime().exec(new String[]{"mkdir","/home/ec2-user/hello"});
ps.waitFor();
}catch(IOException ie){
ie.printStackTrace();
}catch(Exception e){
e.printStackTrace();
}
%>
</html>
执行时,页面无限加载。
为什么不能使用这个命令?
ps = Runtime.getRuntime().exec(new String[]{"su","ec2-user"});