aspose file tools*
The moose likes Beginning Java and the fly likes Local HTTP file question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Local HTTP file question" Watch "Local HTTP file question" New topic
Author

Local HTTP file question

Marcus Laubli
Ranch Hand

Joined: Dec 24, 2004
Posts: 116
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 ]

Marcus L´┐Żubli, SCJP 1.4, CLP 5.0, SCWCD 1.4 (preparing)
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8997
    
    9

The Browser constructor does not take a file name as an argument. It takes a URL.


[How To Ask Questions On JavaRanch]
Damanjit Kaur
Ranch Hand

Joined: Oct 18, 2004
Posts: 346
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

Joined: Dec 06, 2001
Posts: 3061
To get a URL to a file within a JAR file, you can use ClassLoader.getSystemResource().

Layne


Java API Documentation
The Java Tutorial
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Local HTTP file question