File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Apache File Upload in Servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Apache File Upload in Servlet" Watch "Apache File Upload in Servlet" New topic
Author

Apache File Upload in Servlet

sudha swami
Ranch Hand

Joined: Apr 24, 2007
Posts: 179
Hi

I am using Apache File Upload in Servlet. Long before, I set the classpath and runtime path with commons-fileupload.jar .Now I need to use the same apache file upload for different Servlet. Now I want to use the latest version i.e. commons-fileupload-1.2.2.jar. Do I need to delete the old jar file from the classpath and build path inorder to use the latest one?



Any help is appreciated.

Thanks
Sudha
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41865
    
  63
What do you mean by "set the classpath and runtime path"? Why wouldn't you keep the jar file in the WEB-INF/lib directory of your web app?


Ping & DNS - my free Android networking tools app
Ivan Jozsef Balazs
Rancher

Joined: May 22, 2012
Posts: 867
    
    5
Ulf Dittmer wrote:Why wouldn't you keep the jar file in the WEB-INF/lib directory of your web app?



Maybe it will be used in more web apps and there is a wish to avoid the resource hogging due to including the same jars in every web app's lib.
For the projects I work in, we agree upon not including the same axis stuff. etc. in every web app.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61221
    
  66

You have verified that problems are caused when the jar is included in each web app?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41865
    
  63
Ivan, let's not assume what sudha's problem might be. And anyway, the Commons libraries are small, whether they're loaded once or ten times is not much of a difference given the RAM available these days.
sudha swami
Ranch Hand

Joined: Apr 24, 2007
Posts: 179
Hi,

I kept the older version of the jar file and the new version in the WEB-INF/lib folder. Is it OK if both the versions are existing in the same folder. I didn't see any problems yet. Will I see any problems in my application because of the 2 versions.

Thanks
Sudha
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41865
    
  63
Keeping different version of a library in the classpath at the same time is just asking for trouble.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61221
    
  66

Yeah, it's kind of like using a match to try and see if the gas tank is empty. It's gonna blow up on you, probably sooner rather than later.
sudha swami
Ranch Hand

Joined: Apr 24, 2007
Posts: 179
Thank You Bear
sudha swami
Ranch Hand

Joined: Apr 24, 2007
Posts: 179
Hi,

Do I need to use the latest version of jar files? Remove the older version.

Thanks
Sudha
Naveen Kumar Kumar
Greenhorn

Joined: Jul 28, 2010
Posts: 19
Hi Sudha,

Are trying to use the new version of jar for some other servlet, say Servlet2, in the same web app whereas there are existing servlets say Servlet1, which still uses old jars??

If that is the case, then first check the updates included in the new jar, it could support the features present in the old jar. In such case, you can rename/delete the old jar and include the new jar and update build path to refer to this new jar. Make sure the project is build again.

Take required backups in case of any issues...!!


Push the limits to push yourself..!!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Apache File Upload in Servlet