• Post Reply Bookmark Topic Watch Topic
  • New Topic

Bundling Help File w/ Application  RSS feed

 
Jeff Zak
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have created an HTML Help File that is accessed from "Help" on the menu bar of my program. Now that I am getting my program ready to distribute I find I have to change path to this file since users won't be able to access my Documents/Project file from their computers. This file will be included in myproject folder. How would I set up a path in this situation where users might place my program folder on various drives?

 
Les Morgan
Rancher
Posts: 768
19
C++ Java MySQL Database Netbeans IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Include it in your JAR and access it from your program as a resource.
 
Piet Souris
Rancher
Posts: 1984
67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is certainly possible, but it probably has the drawback that it makes the jar file very much bigger.
A rise in size from say 60KB to well over 2MB is no exception.

Besides: when I did that the first time I had the problem that this HTML file, stored as a resource, could easily be launched when the application was run in NetBeans, but not when the app was run as a jar file.

I solved it, more or less, by having the jar file and the html file in the same map, but as two different files. That had some advantages:

1) the help file could be launched separately, just by double clicking
2) the user can store the jar and the help file at any location fit
3) in my jar file, the main file did two things: determine the map it is stored in, and second, it started the real application, giving the path as a parameter. The application could then launch the html file as usual, to whatever browser the user had figured as standard.
4) I explained this situation in a very small ReadMe file.

I know, it was in my java beginning period, so I did not know any better, but I always found this way of doing satisfying. Agreed, the user base was me and at best some direct family...
 
Paul Clapham
Sheriff
Posts: 22509
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are going to be using the HTML help file by opening the default browser with a local URL on your system, then distributing it in the JAR file isn't going to be a solution. I don't think that browsers can understand jar:// URLs. But if you wanted to do this, you could distribute the jar with the HTML included inside it as a resource, then have some code in the jar copy the resource to the user's home directory before using it.

On the other hand if the HTML help file is intended to be used in a browser built in to your application, that might not apply.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!