Getting HTML links to work in a jar file

M

Michael J. Hudson

So, I had some HTML files in a jar file that my application was using
as help files. In those HTML files, I had links to other internal
HTML files as well as links to JPGs and such. In any case, certain
links were not working. When I unzipped the jar, and ran my
application that way (outside of the jar) everything worked fine.
What was going wrong?

The original HTML link looked something like this:

<a link href="my%20link.html">my link</a>

It took a little while, but I eventually figured out what was going
on. The %20 was messing everything up. For whatever reason, outside
of the JAR, the %20 was accurately being translated to mean a "space",
but inside the JAR it was using those characters literally, %, 2, 0.

In my case, these HTML files were created through a macro I was using
in Microsoft Word. If I wasn't doing that, I could have probably just
directly replaced the "%20" with an actual space in those "href"
attributes. When I experimented with this... this did work. However,
in my case, these links were being automatically created. So, I just
had to change the way I set things up so that all the files being
created had no spaces, e.g. I used an underline instead of a space.
And once I did that, it worked... both inside and outside of the jar.
Woohoo!!!

Anyway... just passing this on into the ether in case someone else out
there ever has similar problems.

-Michael
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top