The following piece of program for the compilation process
public void actionPerformed(ActionEvent e) {
try {
input=txinput.getText();
txresult.append(input);
FileWriter save=new FileWriter(new File("file.java"));
save.write(input);
save.close();
Process pid = Runtime.getRuntime().exec("file.java");
BufferedReader in = new BufferedReader(new InputStreamReader(pid.getErrorStream()));
String hasil;
txresult.setText("Result:\n");
while((result=in.readLine())!=null) {
txresult.append(hasil);
txresult.append(System.getProperty("line.separator"));
}
if ((result=in.readLine())==null) {
txresult.append("Source success compiled");
}
in.close();
}
catch(IOException eu){
JOptionPane.showMessageDialog(null,eu);
}
}
});
From the plot above, after saving a file in the development of the extension. Java, then it will be the compilation. Incidentally, I wonder how to make the process of Interpreter or execution entered in the code.
Here's how if we want to compile
javac (then the name of java file which will be compiled)
From here I do not understand, what if the Interpreter or the execution of the program?
This post has been edited by JaCod: 11 November 2010 - 08:16 PM

New Topic/Question
Reply




MultiQuote







|