Open Word From Java

Hi all,
Can we open word from java.
It is possible from VB to do it, bit is it possible from Java.
Thanks in advance for your help.
Best regards.
Saadi MONLA

Probably have to do it using Runtime.exec() and call the word exe in the seperate process.
Note that word will be opened in a seperate OS thread and you will not be able to refer to it from your Java Application.

Similar Messages

  • Invoking Microsoft Word from Java code

    I want to invoke Microsoft word from Java code. How can i do this plz ............... Help

    do something along these lines.... here is an example with notepad
    create a .bat file with the commmand in to run notepad for example
    notpad c:\test.txtthis command calls notepad and passes it the argument C:\test.txt which is the file and it's location, that I want to open.
    The Java program
    import java.util.*;
    import java.io.*;
    public class Run
    public static void main(String args[])
        try
           //the name of the batch file with your commands in
           String command ="runprog.bat";
           //get the runtime 
           Runtime rt  = Runtime.getRuntime();
           //run the bat file  
           Process proc = rt.exec(command);
          //wait for the program to exit i.e notepad then get the return code
          int exitVal = proc.waitFor();
          //print out the exit value
          System.out.println(2THe Process exit value is: " + exitVal);
      catch(Throwable t)
         t.printStackTrace();
    }have a look at this
    http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Runtime.html
    and this
    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps_p.html

  • Open URL from Java in a new browser tab

    Hi OTN,
    Surprisingly can't find the implimintation.
    In an ADF managed bean I retrieve String url. I need to open a new browser tab with this url.
    Found this thread Open a url in a new window in the backing bean which shows using javascript "service.addScript(facesContext, "window.open(http://www.google.coml)");".
    But in my case in doesn't work. The code is executed, but nothing happens. Maybe because the bean is called from a taskflow inline popup.
    ADF 11.1.1.4
    Thanks.

    Well, I'm afraid that is not an option.
    The goButton is in a table row. There are lots of rows so if I use EL for Destination attribute the URL would be retrieved for each of rows.
    The method of URL retreiving is heavyweight operation which includes calling plsql functions, working with strings and others. So if I do it for each table row my application hungs and then I receive an exception of CPU usage.
    That's why I switched to normal commandButton witch actionListener which retrieves url on click - only once. So I need to open URL from Java.

  • Is there a way to open Word from forms 10g?

    Is there a way to open Word from a 10g form? I am trying to pass some data to a word document (like a template). Is there a way to open word from a form button?

    That assumes that the mime types are correctly mapped within the browser and that you already know the location and name of the file on the client machine.

  • Problem opening device from Java on Windows XP

    Hi,
    I am having trouble opening the TUN device (it is a virtual network device developed by the OpenVPN project - http://openvpn.net) from Java on Windows.
    I found from the registry that the key for the device on my machine is
    {5998ABF4-70CC-4B8C-9CBF-F2B985BAD4A2}.
    From elsewhere on the web, I found that on Windows this device can be
    addressed as \\.\{5998ABF4-70CC-4B8C-9CBF-F2B985BAD4A2}.tap
    I then wrote up a short C code,
    char *tun_dev_name = "\\\\.\\{5998ABF4-70CC-4B8C-9CBF-F2B985BAD4A2}.tap";
    FILE *f = fopen(tun_dev_name, "rw");
    fclose(f);
    HANDLE h = CreateFile(tun_dev_name, GENERIC_WRITE | GENERIC_READ, 0, 0, \
    OPEN_EXISTING, FILE_ATTRIBUTE_SYSTEM | FILE_FLAG_OVERLAPPED, 0);
    CloseHandle(h);In the above code, the FILE* returned is non-NULL and the HANDLE returned is positive.
    However, when I try to do the same in Java using the code below,
    String tun_dev_name =
    new String("\\\\.\\{5998ABF4-70CC-4B8C-9CBF-F2B985BAD4A2}.tap");
    RandomAccessFile raf = new RandomAccessFile(tun_dev_name, "rw");
    []/code]
    a "java.io.IOException: Invalid argument" is thrown. The same exception is thrown when I try to open either FileInputStream or FileOutputStream instead of RandomAccessFile.
    In fact, when I invoke the above C code as a native method from within Java,
    though a valid HANDLE is still returned, the FILE* returned is now NULL. I
    have tried giving all permissions to my codebase using Java's policytool, but that didn't help. BTW, I ran all this code on Windows XP from cygwin.
    Clearly this problem isn't with OpenVPN because I'm able to open the device using both fopen and CreateFile from C. Please let me know if one of you knows what the problem could be and what I need to do to fix it. In case, this is not the right forum for this question, kindly let me know which other forum I should pose this question on.
    Thanks!
    Harsha                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    I am sorry but looks like somehow some text got missed out from my message.
    After the C code and before the Java code, I had intended to mention that when that C code is compiled and run independently, both the fopen and CreateFile calls work fine, with a non-NULL FILE* and a valid HANDLE being returned, respectively.
    And as I have already mentioned, when I invoke the C code as a native method from within Java, the CreateFile still works but the fopen fails returning NULL.
    Sorry for missing that out. Hope somebody will be able to help me out.
    Thanks!
    Harsha

  • How To Open Word In Java Application

    Hello
    How To Open Ms-Word Or Ms-Excel Or Any Other Format In Java Application
    According To Their Own ForMat

    The best is to know which program you like to execute. Make those many strings available. Suppose you like to execute M$ Word and M$ Excel. Now do like this..
    String word = "";  // null
    String excel = ""; //null
    /* In the File Class you can find out the methods that can search these files and return thier
    absolute and relative paths. Save those paths in uppe String(s) word and excel and place them in
    runtime.exec( word/excel)...etc. Place this code before a tolbar button and click that..*/

  • Problem with opening browser from Java app.

    Hi guys, I'm not sure if this is the right place to post this, so please excuse me if I'm wrong. I'm trying to open an html page (it's a help file) from a Java application. I'm currently using java.awt.Desktop.     browse(URI uri); which gets the job done, as long as I don't pass any parameters to the page. (e.g. http://www.site.com/site.html?param1=1). Doing that gives me an IOException. Is there a way to do this without using the JNLP API?

    This is the file path copied directly from the browser's address bar:
    file:///home/riaan/EMCHelp/Help.html?page=WorkFlowActivityCategory.html"{code}
    Which causes the app to throw an exception, but when I change it to:
    {code}file:///home/riaan/EMCHelp/Help.html{code}
    it opens Help.html in the browser.  That's why I thought that it might be the query that's a problem.  Perhaps it's a simple issue of not escaping a character or something that I failed to see.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Open word from a servlet

    Hi,
              This is the scenario:
              - the user submits a form and activate a servlet
              - the servlet writes a file ( a word document) to disk
              - now I want the servlet to open the word document....
              How do I do that ?
              - I've tried with a forward request, but that only display the content in
              the browser, I want to open
              the document in word.
              thanks in advance
              ....Per
              

    I fixed it. I was using a jsp page to copy the word doc to the output
              stream. When I changed the program to a servlet, it worked fine. I saw the
              answer in the jsp newsgroup.
              Peace
              "rb" <[email protected]> wrote in message news:[email protected]...
              > I am trying this. Word opens up but the document appears to be corrupted
              > every time.
              > Anyone seen this?
              >
              > "trix" <[email protected]> wrote in message
              > news:[email protected]...
              > >
              > > If you want show the content of the file (i.e. "abc.doc") in a word-like
              > mode and
              > > the browser in use is IE (5.0 sure) you can set the content-type of the
              > page to
              > > "application/msword" on HttpServletResponse than get the output stream
              and
              > call
              > > the print method on it
              > >
              > > response.setContentType("application/msword");
              > > response.getOutputStream().print(===>yourFiletoString<====);
              > >
              > > this will open the plug-in Word in the browser.
              > >
              > > I hope this hint can help you, tell me more if OK or KO!
              > >
              > >
              > > "Per Lovdinger" <[email protected]> wrote:
              > > >Hi,
              > > >
              > > >This is the scenario:
              > > >
              > > >- the user submits a form and activate a servlet
              > > >- the servlet writes a file ( a word document) to disk
              > > >- now I want the servlet to open the word document....
              > > > How do I do that ?
              > > >
              > > >- I've tried with a forward request, but that only display the content
              > > >in
              > > >the browser, I want to open
              > > > the document in word.
              > > >
              > > >thanks in advance
              > > >.....Per
              > > >
              > > >
              > >
              >
              >
              

  • Open PDF from java app

    How can I create a link in a java standalone application to open a pdf file??? (with Acrobat)
    thanks

    And what do you mean by "link"?

  • Why can't I open Word from different apple login?

    I set my wife up with a separate login on our laptop and I noticed that even with full permissions she cannot access any MS Office applications. The program asks to install itself into the HD every time she opens the application, so she'll install it, the application will close, and then we go through the same problem all over again. Any way we can resolve this issue without her needing to login to my account just Word? Thanks

    The answer to your question is no. As long as the software is on the computer, it should be useable.
    Try signing into the Guest account and see if you have the same problem.  You also might try a Safe Mode restart and see if the problem is still present.
    Starting Up in the Safe Mode
    What is Safe Mode
    The first option may identify it as an account problem and the second option may identify it as 3rd party software.

  • Opening HTML from Java executable?

    I have an HTML file that will be located on a CD that spawns off an installation. I need to call this HTML from a java executable. How do I do this?
    Thanks,
    Scott Roth
    [email protected]

    You may adopt a refined solution trough the swing package.... Usign the application to shows the HTML file with a JEditorPane or JPane component.
    take a look in the jdk1.2.2\demo\jfc\SwingSet\HtmlPanel.java
    In this case, your app may becomes slow, but if you will run it in a powerfull machine (128Mb RAM, 16Mb Video) then don�t worry - it works.

  • Opening files from java application by other programs

    Hi! Could you tell me how to solve such task. After saving of file on local drive by applet i need to show a link "View file" that will open file by assotiated programs (.doc - MSWord, .pdf - Acrobat Reader etc. applet will work on Linux platform too). Thanks!

    Just provide a link to the file and leave it up to the OS to determine which program to use to open it.

  • Word access from Java

    Were can i information find?
    Word access from the Java programm.
    Bulj

    Be more specific if you could. Do you want to open up Microsoft Word from Java?
    jmschrei

  • Using word/excel from java (client or weblogic server)

    Hi everybody,
    i want to use excel / word functionality from java in two different variants:
    -> serverside
    -> clientside
    I tried the weblogic.comc and i got serveral classes but in the remote-package i got only a utitlity-class.
    My knowlege about COM is rather bad.
    Does anybody did this bevor and
    -> can say me, if it is correct, that i only got a utility-class (so how will i use it from the client ?!)
    -> has a example for using Excel / Word from Java in bea weblogic
    -> has a example for using Excel / Word directly in a client (not via rmi)
    Thanks
    Ciao
    Sven

    Sven, This is a really bad idea. Why don't you tell me
    what your trying to do and I wil surely give you a better alternative
    JRadecki
    "Sven Roesner" <[email protected]> wrote:
    >
    Hi everybody,
    i want to use excel / word functionality from java in two different variants:
    -> serverside
    -> clientside
    I tried the weblogic.comc and i got serveral classes but in the remote-package i got only a utitlity-class.
    My knowlege about COM is rather bad.
    Does anybody did this bevor and
    -> can say me, if it is correct, that i only got a utility-class (so how will i use it from the client ?!)
    -> has a example for using Excel / Word from Java in bea weblogic
    -> has a example for using Excel / Word directly in a client (not via rmi)
    Thanks
    Ciao
    Sven

  • Open url from xchat in opera

    I'd like to open urls from xchat in opera.
    Under settings>advanced>url handler:
    !opera -remote 'openURL(%s)'
    xchat has tcl as an optional dep, so I installed that.
    This is in xfce4 and I have set opera as the preferred browser.

    Well, I'm afraid that is not an option.
    The goButton is in a table row. There are lots of rows so if I use EL for Destination attribute the URL would be retrieved for each of rows.
    The method of URL retreiving is heavyweight operation which includes calling plsql functions, working with strings and others. So if I do it for each table row my application hungs and then I receive an exception of CPU usage.
    That's why I switched to normal commandButton witch actionListener which retrieves url on click - only once. So I need to open URL from Java.

Maybe you are looking for