• Post Reply 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 ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

About help file's directory

 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, all,
I have a help menu when select will show a JEditorPane contains the userguide. I have the relative directory of the userguide in my programe.
But when I run the jar file from other directory other than the directory contains the relative directory, the system could not found it. How could I do to deal with it wherever I run the application?
Recards
Davidd
[ September 28, 2003: Message edited by: Davidd Smith ]
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I wrote a routine that iterated through all the classpaths. If the classpath was a .jar file, then I had to use a JAR url to retrieve the helpfile from the JAR file.
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You might want to take a look at ClassLoader.getSystemResource(). It also may be worthwhile to put a copy of your documentation in runme.jar, to guarantee it will be accessible. In my instructions at least, the appication might be started from any directory, and we can't make any assumptions about the prexisting classpath. But we do know that the application is started with
java -jar runme.jar [mode]
So we know that runme.jar is in the classpath, even if nothing else is.
 
Davidd Smith
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Jim and James,
Thank you for your reply, I see
Regards
Davidd
 
Bartender
Posts: 1872
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jim:
You might want to take a look at ClassLoader.getSystemResource().

Nice ! I didn't know that method. I wrote a getExecutionPathOf(Class aClass) method which could be simplified with ClassLoader.getSystemResource() IMO :

Anyway Davidd, passing any of your classes (the main one is a good candidate) to such a method will return the absolute path where your runme.jar is.
Best,
Phil.
[ September 30, 2003: Message edited by: Philippe Maquet ]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic