Archived

This topic is now archived and is closed to further replies.

does anyone know how to work java JAR files?

This topic is 5110 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have an applet that calls a servlet on a remote server. The servlet file is MyServlet.class, and a couple of other helper classes. I just stuck these classes in the appropriate folder on my test webserver, and used this code to access the servlet: address = "http://localhost:8080/servlet/MyServlet"; Everything worked fine when I did this. However, someone told me it would be better to have all the server classes in one jar file, instead of just a whole bunch of class files laying around. So I jared the file up, and now it is called MyJar.jar. Now the servlet Address above does not work. I expected this, but the problem is, I cant find anything that does work. Ive tried all of these addresses and none of them work to access my jar: address = "http://localhost:8080/servlet/MyServlet"; address = "http://localhost:8080/servlet/MyJar/MyServlet"; address = "http://localhost:8080/servlet/MyJar.jar/MyServlet"; address = "http://localhost:8080/servlet/MyJar.jar.MyServlet"; address = "http://localhost:8080/servlet/MyJar.MyServlet"; The error I keep getting is this: java.io.FileNotFoundException: http://localhost:8080/servlet/whatever address I tried Please help me if you know about this kind of thing. JARs have always pissed me off

Share this post


Link to post
Share on other sites
I'd get a better reason to JAR files than "someone told me so," but thats just me.

JARs are just ZIP files. Usually in whatever server you have running you show it the path to the JAR file and it looks in there.

[edited by - antareus on December 16, 2003 10:53:37 AM]

Share this post


Link to post
Share on other sites
Well, Ive always kind of known that Jar files are the standard way to deploy java stuff to keep everything together. And it wasnt really that someone recommended me to do it, its more that they told me to do it

Besides, I''d get a better reason to not JAR files than "I cant figure it out," but thats just me.

Anyway thanks for the tip about the zip thing. Already knew this (although JARS arent compressed, are they?), but that still doesnt help. I know you have to show it the path to the jar, and thats what I was unsuccessfully attempting to do, and thats what I as asking for help with.

Thanks,
Andre.

Share this post


Link to post
Share on other sites
Try this link:

http://java.sun.com/docs/books/tutorial/jar/

that should get you started.

============================
A guy, some jolt, and a whole lot of code

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Servlets are often packaged in WAR files, Web Archives. It''s effectively the same thing, a Java Archive, but it has a more consistent structure.

Share this post


Link to post
Share on other sites
btw - they were atleast around since the early 1990s

I think it was between 1988 and 1991 some time when I first stumbled across them in one of the ARJ/RAR/JAR distributions.
They even had a really cool interface. It was like the old XTGOLD but for the archives only. XTGOLD could read them too. So could the XTGOLD for windows.

That was some awesome software back then.

back before I even had a modem.

hehe - back when I was using Borland Turbo C++ v2.0 on the 5.25" disks and I had a 20mb hard disk.

Share this post


Link to post
Share on other sites