aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Jar File question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Jar File question " Watch "Jar File question " New topic
Author

Jar File question

Sam Stackly
Ranch Hand

Joined: May 04, 2002
Posts: 109
Hi Guys,
I've tried to run my client application jar but I am getting wired exception as I copied below
is there anything wrong with my system or my jar has problem?
thanks
Sam
btw, here is the code and message

C:\suncertify>java -jar FBNCLinet.jar
Exception in thread "main" java.util.zip.ZipException: The system cannot find the file specified
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(Unknown Source)
at java.util.jar.JarFile.<init>(Unknown Source)
at java.util.jar.JarFile.<init>(Unknown Source)
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Hi Sam,
It looks like you may be trying to load something from the jar file as a file instead of a resource.
You have to load things up in a jar as a URL similar to this:

Hope this helps,
Michael Morris


Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Sam Stackly
Ranch Hand

Joined: May 04, 2002
Posts: 109
Thanks Michael,
Sam
Sam Stackly
Ranch Hand

Joined: May 04, 2002
Posts: 109
Michael,
I followed your comment and changed my help file path by using URL. but I am still getting that error. I really don't know what to do , any idea or comment??
Thanks in advance
Sam
Mag Hoehme
Ranch Hand

Joined: Apr 07, 2002
Posts: 194
Hi,
I'm afraid loading resources from jar files works only for gifs, jpgs, and .au files (but I am not 100 percent sure on this - anybody out there who knows for sure?).
I am circumventing this problem by putting my help file into a separate directory.


Mag
Nate Johnson
Ranch Hand

Joined: May 13, 2002
Posts: 301
Originally posted by Mag Hoehme:
I'm afraid loading resources from jar files works only for gifs, jpgs, and .au files (but I am not 100 percent sure on this - anybody out there who knows for sure?).
I am circumventing this problem by putting my help file into a separate directory.

I loaded my html help file from my client jar, so I can say that at least html can be added to that list .


scwcd, scjd, scjp<br /><a href="http://natejohnson.us" target="_blank" rel="nofollow">http://natejohnson.us</a><br /><a href="http://rice.kuali.org" target="_blank" rel="nofollow">http://rice.kuali.org</a>
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Hi Sam,

I followed your comment and changed my help file path by using URL. but I am still getting that error. I really don't know what to do , any idea or comment??

Are you attempting to save a file to the local jar? I'm not sure that is possible. I recall reading a post on one of the Java in general forums about the same problem that you are having and as I recall the consensus was that it was not possible.
And by the way, you can load anything in the local jar as a resource including simple files. I just don't think it is possible to save anything back to it.
Michael Morris
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Jar File question