Thanks for your reply, but in this example, com.apple.mrj.MRJFileUtils is need. How can I do?
I want to open XML file in IE in JAVA program, this file is stored at local machine.
Thanks again
Here is an example that runs on my system and launches IE with the yahoo home page. YMMV.
import java.io.*;
public class Test {
public static void main (String args[]) throws IOException {
Runtime rt = Runtime.getRuntime();
rt.exec("c:\\progra~1\\plus!\\Micros~1\\Iexplore.exe
This is really not a better solution. On my system 'EXPLORER' refers to windows explorer not Internet Explorer. If I try to use this, it doesn't open a browser, it generates an error, hence the solution I used above. This is why it's not portable. Does this actually work on your system? What OS are you using?
IEXPLORE lauches Explorer. The other method will not work on most people's machines. For example the path to my IE is at C:\PROGRAM FILES\INTERNET EXPLORER. IEXPLORE should be mapped to IE on all Windows Systems. Wushutwist
Have you actually tried this? I have and it doesn't work. In fact, I have machines running windows 98, windows 2000 and windows nt and it doesn't work on any of them. The reason is because IExplore.exe is not in the system path (and there is no reason for it to be). That is why I used the complete path in my example above and why I said that this solution is NOT PORTABLE.
Please try running the examples that you give before you offer them as a solution. All of the things you say 'should' work, don't.
Actually I did try it and it did work. As you said IExlore.exe may not be in your PATH. I was suggesting it as an alternative to your post because I know many machines do not store IE in the same directory and therefore you solution also would not work. The only real solution would be to check the windows registry for the directory path to IE and run that. Just to let you know I don't try to post blindly. Wushutwist
I work in windows 98 it is working fine for me.
If u use just Explorer, then it opens windows explorer.
If u specify a html file or any file with it, then it opens up with the IExplorer.
C:\>java Test
Exception in thread "main" java.io.IOException: CreateProcess: IEXPLORE error=2
at java.lang.Win32Process.create(Native Method)
at java.lang.Win32Process.<init>(Win32Process.java:66)
at java.lang.Runtime.execInternal(Native Method)
at java.lang.Runtime.exec(Runtime.java:551)
at java.lang.Runtime.exec(Runtime.java:418)
at java.lang.Runtime.exec(Runtime.java:361)
at java.lang.Runtime.exec(Runtime.java:325)
at Test.main(Test.java:7)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.