| Author |
Opening HTML file from a desktop application
|
Tomek Domek
Greenhorn
Joined: May 16, 2009
Posts: 4
|
|
Hi,
Can somebody help me. I have a fragment of code that is used to open HTML file from the C: drive in windows when a button is clicked. It did work perfect but one day it stopped working and I didn't do any changes inside the code, I really don't know why.
Here is the code (everything is in the actionPerformed method),the problem is only in the URI.
URI uri = new URI("file:///C:/new%20software/col.html");
uri.normalize();
Desktop.getDesktop().browse(uri);
The above code worked fine previously. I have noticed that if I will remove 'file:///' and '%20' and remove spaces then it works fine, but It also worked before without this changes.
Thanks for help.
|
 |
jittu goud
Ranch Hand
Joined: Mar 30, 2007
Posts: 46
|
|
|
what error does it gives when it compiles ....
|
 |
Tomek Domek
Greenhorn
Joined: May 16, 2009
Posts: 4
|
|
There are no errors at the compile time, also there are no exceptions being thrown at runtime and that's why I am cofused coz it worked well before
The file path is also correct, just nothing happens when a button is clicked and the problem is that html file is not opening. Do you have any idea what may cause this?
Thanks a lot
|
 |
jittu goud
Ranch Hand
Joined: Mar 30, 2007
Posts: 46
|
|
not sure why its happening for you...
check the file you have referring is having correct path or not...try opening the file:///C:/new%20software/col.html in normal browser....
or may be some popup blocker software is blocking....
change your default browser...and disable any popup blockers...and try again...
I tried the followiing
and it works fine for me
|
 |
Tomek Domek
Greenhorn
Joined: May 16, 2009
Posts: 4
|
|
Thanks very much
I've changed a browser to Firefox and now it works fine. But now I am very curious why it did suddenly stop working with IE .
|
 |
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12271
|
|
One possibility - Java path and file names are always case sensitive - perhaps the use of case in the actual file name changed.
Bill
|
Java Resources at www.wbrogden.com
|
 |
Tomek Domek
Greenhorn
Joined: May 16, 2009
Posts: 4
|
|
I was thinking that it might be because of that, but the file name and path are identical. With IE it works fine when I copy and paste it directly into browser but from inside the code it works only if I will remove file:/// and %20 and folder names are without the space character. I can't remind myself what I might have changed (if I did any changes) the day it stopped working
|
 |
 |
|
|
subject: Opening HTML file from a desktop application
|
|
|