package java_file;
import java.io.*;
import java.awt.Desktop;
/**
*
* @author bluejundi
*/
public class java_exec {
public static void main(String[] args) {
String path = new String("E:\\OFFICE\\OFFICE11\\winword.exe d:\\surat_suara.doc");
try {
System.out.println("Menjalankan MS Word");
Process theProcess = Runtime.getRuntime().exec(path);
} catch(IOException e)
{import java.io.*;
import java.awt.Desktop;
/**
*
* @author bluejundi
*/
public class java_exec {
public static void main(String[] args) {
String path = new String("E:\\OFFICE\\OFFICE11\\winword.exe d:\\surat_suara.doc");
try {
System.out.println("Menjalankan MS Word");
Process theProcess = Runtime.getRuntime().exec(path);
} catch(IOException e)
System.err.println("Error on exec() method");
e.printStackTrace();
}
try {
Desktop desktop = null;
if (Desktop.isDesktopSupported()) {
desktop = Desktop.getDesktop();
}
System.out.println("Membuka file pamflet.doc");
desktop.open(new File("d:\\pamflet.doc"));
} catch (IOException ioe) {
ioe.printStackTrace();
}
}
}
Assalamulaikum pak
ReplyDeleteini saya kemaren coba iseng buat soal 4 uas via JFrame dan hasilnya seperti ini pak..
mohon kritik dan sarannya
http://datacomnet.blogspot.com/
Trimakasih
wassalamualaikum..