Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Loading .jar files

 
Peter Kirk
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20608
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Peter Kirk
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20608
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic