• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Local HTTP file question

 
Marcus Laubli
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found the following code on the web:



I compiled it and it runs just fine.

My next steps are to:

1) put all 4 of the class files and about 4,000 HTML files into a JAR file. I tried to run jar -cf jarName.jar *.class to import the class files into my Jar, but it didn't work. I was able to get the class files into the Jar, but I guess it's having problems finding the "executoable" public static void main(String [] args)...


2) I want to use this code to launch index.html which will be inside of the Jar file.

3) from index.html, allow the user to navigate from one page in the JAR file to the next.

How can I do this?

Currently the line



is not accepting index.html as the default html file name.

What do I have to point Browser() at?
[ January 26, 2005: Message edited by: Marcus Laubli ]
 
Joe Ess
Bartender
Posts: 9295
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Browser constructor does not take a file name as an argument. It takes a URL.
 
Damanjit Kaur
Ranch Hand
Posts: 346
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) I tried to run jar -cf jarName.jar *.class to import the class files into my Jar, but it didn't work.


use jar -cfm option to create jar file specifying all class files and create a manifest file.

having problems finding the "executoable" public static void main(String [] args)...


edit Manifest file to add another line

Main-Class: classname

the class which has main(..) method.
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To get a URL to a file within a JAR file, you can use ClassLoader.getSystemResource().

Layne
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic