Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / August 2003

Tip: Looking for answers? Try searching our database.

how to access jar components from an excuting jar file

Thread view: 
Z.M. - 20 Aug 2003 01:22 GMT
Hello.
I would like to make an executable jar file which will contain html files
and be able to
present those files in a JEditorPane that implements a HyperlinkListener.
Can this be done ?
I am struggling with how to obtain the html text from the running jar file.
Thanks in advance.
Roedy Green - 20 Aug 2003 01:46 GMT
>I am struggling with how to obtain the html text from the running jar file.
>Thanks in advance.
You fish them out much the same way you would an Image. See
http://mindprod.com/jgloss/image.html

Rendering the HTML becomes a problem.  Swing's html rendering is only
HTML 3.2.  See http://mindprod.com/jgloss/htmlrendering.html for your
alternatives.

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
Brad BARCLAY - 20 Aug 2003 02:56 GMT
> Hello.
> I would like to make an executable jar file which will contain html files
> and be able to
> present those files in a JEditorPane that implements a HyperlinkListener.
> Can this be done ?
> I am struggling with how to obtain the html text from the running jar file.

    Take a look at the Class class (java.lang.Class).  It has a
getResource() method and a getResourceAsStream() method.  The first will
give you a URL object you can use to read the data, and the latter gives
you an instance of InputStream you can use (or wrapper) for data input.

    JavaHelp uses this pretty extensively to load HTML files out of JARs,
so if you want to see some sample code of this at work, take a look at
JavaHelp's sources (available through http://java.sun.com).

Brad BARCLAY

Signature

=-=-=-=-=-=-=-=-=
From the OS/2 WARP v4.5 Desktop of Brad BARCLAY.
The jSyncManager Project:  http://www.jsyncmanager.org




Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.