Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
    Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
  • Piet Souris
  • Himai Minh

How to open an HTML file from an applet both of which are inside a JAR file?

Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
This question has been asked many times on this site and at some other java resource sites.
Taking help from the replies posted, I have used the getResource() method of the ClassLoader class.
The HTML file is "abc.html"
The url obtained is "loaderresource://Z/CRWSbHlp.html" which the browser cannot display!! The standard error "The page canot be displayed" screen was displayed.
My code is as follows :

Another method I tried out was with the following code:

Both the outputs of the url in the java console as well as in the url window is :

I have tested the code both from a local pc as well as a webserver.
in the case of the web server, the url in the url window is blank, though the url obtained in the java console is the same as above.
I would appreciate if anyone could point out any mistake in my code or offer an alternative.
p.s.: sorry for posting this topic in more than one forum, but I needed a solution by all means!!
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Please do not cross post. Please find the conversation here.
A wop bop a lu bop a womp bam boom! Tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
    Bookmark Topic Watch Topic
  • New Topic