Getting HTML links to work in a jar file

Discussion in 'Java' started by Michael J. Hudson, Nov 19, 2004.

  1. 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
     
    Michael J. Hudson, Nov 19, 2004
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. lucy
    Replies:
    6
    Views:
    30,664
    steve
    Sep 7, 2004
  2. Arnold Peters
    Replies:
    0
    Views:
    587
    Arnold Peters
    Jan 5, 2005
  3. muttley
    Replies:
    0
    Views:
    2,731
    muttley
    Oct 20, 2005
  4. cyberco
    Replies:
    4
    Views:
    3,773
    Roedy Green
    Feb 14, 2006
  5. Arnold Peters
    Replies:
    0
    Views:
    670
    Arnold Peters
    Jan 5, 2005
Loading...

Share This Page