View Single Post
  #8 (permalink)  
Old 05-06-2008, 03:16 PM
sanjeevtarar's Avatar
sanjeevtarar sanjeevtarar is offline
Senior Member
 
Join Date: Apr 2008
Location: Delhi(India)
Posts: 249
sanjeevtarar is on a distinguished road

What i understand you want to open a word file using java code..If i am wrong then correct me.

Try this.

Code:
import java.io.*; public class OpenWord { public static void main(String[] args){ try{ String fileName = "C:\\New.doc"; Runtime.getRuntime().exec("rundll32 SHELL32.DLL,ShellExec_RunDLL \""+fileName+"\""); // OR YOU CAN USE Runtime.getRuntime().exec("cmd /c \""+fileName+"\""); }catch(IOException err){ // or use catch(Throwable err) System.out.println("ERROR...."+err); } } }
__________________
sanjeev,संजीव
Reply With Quote