I was trying to open a word file using Visual Basic and came across this code. I really don't had a idea that using Java I can do this. And was really excited about this. And thought this was worth sharing. So here is it
Import java.io.*;
public class Doc
{
public static void main(String[] str)throws IOException
{
Runtime rt = Runtime.getRuntime();
Process p = rt.exec("C:\\Program Files\\Microsoft Office\\Office10\\WINWORD.exe document.doc");
}
}
Here
Document is- filename
Winword-path of executable with which u want to open the file.
So using this code you can open a .doc file in Microsoft Word


LinkBack URL
About LinkBacks




Reply With Quote