Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Html file inside jar

Reply
Thread Tools

Html file inside jar

 
 
Setesh
Guest
Posts: n/a
 
      06-01-2005
Hello,

I've created a jar, which contains also description.html. Now in my main
class I want to show it on the screen using JEditorPane. But to do that I
need a path to that file (it works when I specify the whole path, like
file:///c:/myFiles/.../description.html, but I want to make it more elastic
and get it from jar archive).
How can I get it??

Greetz, setesh


 
Reply With Quote
 
 
 
 
Real Gagnon
Guest
Posts: n/a
 
      06-02-2005
> I've created a jar, which contains also description.html. Now in my
> main class I want to show it on the screen using JEditorPane. But to
> do that I need a path to that file (it works when I specify the whole
> path, like file:///c:/myFiles/.../description.html, but I want to make
> it more elastic and get it from jar archive).
> How can I get it??


....
URL url = getClass().getResource("description.html");
tp.setPage(url);
....

Bye.
--
Real Gagnon from Quebec, Canada
* Looking for Java or PB code examples ? Visit Real's How-to
* http://www.rgagnon.com/howto.html
 
Reply With Quote
 
 
 
 
Andrew Thompson
Guest
Posts: n/a
 
      06-02-2005
On Wed, 1 Jun 2005 23:38:23 +0200, Setesh wrote:

> I've created a jar, which contains also description.html.

....
> How can I get it??


<http://www.physci.org/codes/javafaq.jsp#path>

HTH

--
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.LensEscapes.com/ Images that escape the mundane
 
Reply With Quote
 
Thomas Weidenfeller
Guest
Posts: n/a
 
      06-02-2005
Setesh wrote:
> I've created a jar, which contains also description.html. Now in my main
> class I want to show it on the screen using JEditorPane. But to do that I
> need a path to that file (it works when I specify the whole path, like
> file:///c:/myFiles/.../description.html, but I want to make it more elastic
> and get it from jar archive).
> How can I get it??


This is an FAQ (only that this group hasn't got a Usenet FAQ for a long
time ...):

Look up
Class.getResource()
Class.getResourceAsStream()

And if you have a lot of HTML help info to display consider using Suns
JavaHelp extension.

/Thomas


--
The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/...g/java/gui/faq
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
jaas.jar, jta.jar jdbc-stdext.jar missing from jdk1.5 RPM muttley Java 0 10-20-2005 02:40 PM
Differences of xercesImpl.jar, xercesImpl-J.jar, dom3-xercesImpl.jar ? Arnold Peters Java 0 01-05-2005 10:59 PM
Package jar files inside EJB jar file? harry Java 1 11-22-2004 10:11 PM
reference to a jar file inside another jar file JML Java 3 10-26-2004 06:31 AM
how to disassembly a .jar file? how to see what are the classes inside the .jar file? lucy Java 6 09-07-2004 09:54 PM



Advertisments