use can use the process class. eg. Process p = Runtime.getRuntime().exec("<executble file name iec:\word.exe>","<document file name>"); The process class is the best way to invoke a file from word. Like this u can use the same class to call any exe file. real eg: Process p = Runtime.getRuntime().exec("c:\word.exe","test.doc");
I tried this Process p = Runtime.getRuntime().exec("E:\Program Files\Microsoft Office\Office\winword.exe","test.doc"); and I get an Illegal escape character Do you have an idea?
Younes
By constantly trying one ends up succeeding. Thus: the more one fails the more one has a chance to succeed.
Younes, Try Process p = Runtime.getRuntime().exec("E:\\Program Files\\Microsoft Office\\Office\\winword.exe","test.doc"); It still won't work. Can you figure out why? [ June 12, 2002: Message edited by: Dirk Schreckmann ]
Dirk I tried with Process p = Runtime.getRuntime().exec("C:\\Program Files\\Microsoft Office\\Office\\winword.exe" ,"C:\\backup\\testt.doc"); When run the application following error prompt as java.io.IOException: CreateProcess: C:\Program Files\Microsoft Office\Office\winword.exe,C:\backup\testt.doc error=2 at java.lang.Win32Process.create(Native Method) .....................
showing that there is some error in Win32Process class.... Please help ! Thanks
Hi, I tried doing : Runtime.getRuntime().exec("C:\\Program Files\\Microsoft Office\\Office\\winword.exe C:\\hello.doc"); and it works. The hello.doc has to be there already existing. Can someone throw some light on : (a) How to use the .exec(String, String[]) version. ( name, value pair thing mentioned in javadoc is confusing ) (b) How to create a new document ( ie when hello.doc is not existing )