Thread: Javapad 2.0
View Single Post
  #3 (permalink)  
Old 05-13-2008, 08:36 AM
Eku Eku is offline
Senior Member
 
Join Date: May 2008
Location: Makati, Philippines
Posts: 228
Eku is on a distinguished road
WAW thanks a lot. I really appreciate it. =)
I just used the command line in Compiling. Here is the Command i used. i just cut it from the main code. I just invoke the Javac and java commands. One more problem is how do i Handle those errors in compiling. I will read the compilerClass, thanks for informing that, Im still have lots to learn about java. =)

Code:
else if (command.equals("Build")) { try { File filename2 = new File(filename.getAbsolutePath().substring(0,filename.getAbsolutePath().lastIndexOf("."))); String s ="javac -cp \""+ filename2.getAbsolutePath().substring(0, filename2.getAbsolutePath().lastIndexOf("\\"))+"\" \""+ filename2.getAbsolutePath() +".java\""; Runtime.getRuntime().exec(s); JOptionPane.showMessageDialog(this,"Building Succesful"); } catch (Exception ex){ System.err.println(ex); JOptionPane.showMessageDialog(this,"Building Error");} } else if (command.equals("Run")) { try { File filename3 = new File(filename.getAbsolutePath().substring(0,filename.getAbsolutePath().lastIndexOf("."))); String s ="cmd.exe /k start java -cp \""+ filename3.getAbsolutePath().substring(0, filename3.getAbsolutePath().lastIndexOf("\\")) + "\" "+ filename.getName().substring(0,filename.getName().lastIndexOf(".")); Process process = Runtime.getRuntime().exec(s); BufferedReader stdout = new BufferedReader(new InputStreamReader(process.getInputStream())); JOptionPane.showMessageDialog(this,"Run Succesful"); } catch (Exception ex){ System.err.println(ex); JOptionPane.showMessageDialog(this,"Run Time Error");} }else if (command.equals("Open Command Line")) { try { Runtime.getRuntime().exec("cmd.exe /k start cd \\");} catch (Exception ex){ System.err.println(ex); JOptionPane.showMessageDialog(this,"Run Time Error");} }

Last edited by Eku : 05-13-2008 at 08:40 AM.
Reply With Quote