Guest
Answered On : Jan 3rd, 2006
The question is a bit ambigiuos.I understood that you want to open doc(MS-WORD) file using java program.Am I Right?
Anyhow if u want to open non-java application,You can use class java.lang.Runtime class.
The following java program opens a word file named 'OAFAQs.doc'.
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\\OFFICE11\\WINWORD.exe OAFAQs.doc");
}
}
Here the "C:\\Program Files\\Microsoft Office\\OFFICE11\\WINWORD.exe" is the executable file for MS-WORD.
Login to rate this answer.
Sreeni
Answered On : Feb 21st, 2006
There are two kinds of Javadoc comments: class-level comments, and member-level comments. Class-level comments provide the description of the classes, and member-level comments describe the purposes of the members. Both types of comments start with /** and end with */.
- @author: Describes the author of the document. Used in class-level comments
- @param: Describes a parameter of a method or constructor.
- @return: Describes the return type of a method.
- @throws: Describes an exception a method may throw.
- @exception: Describes an exception.
Login to rate this answer.
anshuman
Answered On : Apr 15th, 2007
I have used your source code
it opens the word software but it does not open the file
it is saying that permission is not there
pls provide some help on it
Login to rate this answer.
Here is the correct code for this. Save anywhere your document file it search and open.
import java.io.*;
public class Example {
public static void main (String[] args) throws IOException
{
Runtime rt=Runtime.getRuntime();
rt.exec( "C:Program FilesMicrosoft OfficeOFFICE14WINWORD.exe notes.doc" );
}
}
Login to rate this answer.