jQuery in Action, 2nd edition*
The moose likes Java in General and the fly likes Loading .jar files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Loading .jar files" Watch "Loading .jar files" New topic
Author

Loading .jar files

Peter Kirk
Greenhorn

Joined: Oct 12, 2011
Posts: 12
Hi - is it possible that a classloader will load "jar" files which do not have a ".jar" extension? I recently deployed a newly compiled jar file to a server, and renamed the existing jar to "myjarfile.jar.old". But it seems that this jar file was still loaded despite the extension being ".old" - can that be possible? This was code running under a web-app under Resin4.
Thanks
Peter
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19651
    
  18

Welcome to the Ranch!

Did you restart the server afterwards? Often applications cache the classes loaded from files until you restart the applications. From experience, Tomcat does this as well (at least by default). Whenever I have to update a library I have to restart the entire Tomcat server.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Peter Kirk
Greenhorn

Joined: Oct 12, 2011
Posts: 12
Hi, thanks for the reponse. Yes, I did restart the server. It just seems that jar files (despite the extension not being ".jar") are loaded by the jvm. I was just wondering if this could be correct, or there's something else I've missed.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19651
    
  18

Well, it's certainly possible. The file still is a JAR file, even if you've renamed it. And JAR files in turn are just ZIP files. Perhaps it would help if you rename it to .txt, tricking the server into thinking it's a text file, but the safest option is to simply move it elsewhere.
 
 
subject: Loading .jar files
 
Similar Threads
Taglib file outside WEB-INF
Regarding WAR file
question9 from HFSJ mock exam
JAR or zip
WAR file