Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Loading a HTMl file on runtime  RSS feed

 
Abhi Venu
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mates,

I was trying to load a html page via my java code. It is a eclipse project. When i run from IDE it works fine.
But when i export it as a jar it doesnt work. Please tell how this can be resolved

I tried to open the html page using this.
java.awt.Desktop.getDesktop().browse(new URI("images/NetWorking.html"));

The needed files are placed under this D:\WORKSPACE\myIPFinder\images


Regards
Abhi
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The default directory is sure to be different when running a standalone app compared to running it inside of an IDE, so use an absolute path instead of a relative path.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!