解决方案 »
- C#关于泛型反射问题,请高手给予详细指点
- C#中如何输出字符串的地址及占用内存大小
- 多文件上传
- 把c#连接sql数据库代码封装在c++写的DLL里,c++的代码是怎样写的?
- C#调用API
- GridView删除确认问题,OnClientClick="return confirm('确认要删除此行信息吗?')" ,点取消时候根本不行啊!![顶者有分]
- 自己对四舍五入和银行家舍入的研究
- c#连接数据库的问题,大家进来说说(100分相送,如不够,可再添)
- 序列化和反序列化
- winform下使用WebKitBrowser 如何获得页面中iframe的document,并对元素进行操作
- 做过C#扑克牌游戏的,请过来帮我看看啊
- c#下载歌词怎么实现
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;public class Compile {
private String mess = null;
private File file;
private Runtime run;
private Process pro;
public static void main(String[] args) throws InterruptedException{
Compile com = new Compile();
com.setFile(new File("D:\\Test\\Java23"));
System.out.println(com.isCompile());
} public Compile() {
this.run = Runtime.getRuntime();
} public void setFile(File file) {
this.file = file;
} public String isCompile() throws InterruptedException {
try {
System.out.println(this.file.getPath());
this.pro = this.run.exec("cmd.exe /c javac " + this.file.getPath() + ".java");
BufferedReader buf = new BufferedReader(new InputStreamReader(this.pro.getErrorStream()));
String str;
while ((str = buf.readLine()) != null) {
mess += str + "\n";
} if (null == this.mess) {
this.mess = "编译成功";
}
return mess;
} catch (IOException ex) {
return ex.getMessage();
}
}
}