public class main {
// public static BufferedReader br;
public static BufferedWriter bw;
public static void main(String[] args) {
String cmd ="java -Didea.launcher.port=7544 \"-Didea.launcher.bin.path=D:\\Program Files\\JetBrains\\IntelliJ IDEA 11.0.1\\bin\" -Dfile.encoding=UTF-8 -classpath \"D:\\workspace\\thinking\\bin;D:\\java_tools\\jdk1.6.0\\jre\\lib\\alt-rt.jar;D:\\java_tools\\jdk1.6.0\\jre\\lib\\charsets.jar;D:\\java_tools\\jdk1.6.0\\jre\\lib\\deploy.jar;D:\\java_tools\\jdk1.6.0\\jre\\lib\\javaws.jar;D:\\java_tools\\jdk1.6.0\\jre\\lib\\jce.jar;D:\\java_tools\\jdk1.6.0\\jre\\lib\\jsse.jar;D:\\java_tools\\jdk1.6.0\\jre\\lib\\management-agent.jar;D:\\java_tools\\jdk1.6.0\\jre\\lib\\plugin.jar;D:\\java_tools\\jdk1.6.0\\jre\\lib\\resources.jar;D:\\java_tools\\jdk1.6.0\\jre\\lib\\rt.jar;D:\\java_tools\\jdk1.6.0\\jre\\lib\\ext\\dnsns.jar;D:\\java_tools\\jdk1.6.0\\jre\\lib\\ext\\localedata.jar;D:\\java_tools\\jdk1.6.0\\jre\\lib\\ext\\sunjce_provider.jar;D:\\java_tools\\jdk1.6.0\\jre\\lib\\ext\\sunmscapi.jar;D:\\java_tools\\jdk1.6.0\\jre\\lib\\ext\\sunpkcs11.jar;D:\\Program Files\\JetBrains\\IntelliJ IDEA 11.0.1\\lib\\junit.jar;D:\\Program Files\\JetBrains\\IntelliJ IDEA 11.0.1\\lib\\idea_rt.jar\" com.intellij.rt.execution.application.AppMain thinking.SubProcess";
try {
Process p = Runtime.getRuntime().exec(cmd);
// br = new BufferedReader(new InputStreamReader(p.getInputStream()));
bw = new BufferedWriter(new OutputStreamWriter(p.getOutputStream()));
bw.write("hello,wuche" + "\n");
bw.flush();
bw.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
public class SubProcess {
public static BufferedReader br;
public static BufferedWriter bw;
public static void main(String[] args) throws IOException {
String result =null;
// System.err.println(1025);
// System.out.println("hello,wuche!");
try {
br = new BufferedReader((new InputStreamReader(System.in)));
result = br.readLine();
File f = new File("D:\\temp.txt");
bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(f)));
bw.write(result);
bw.flush();
br.close();
bw.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
}