aspose file tools*
The moose likes Java in General and the fly likes Library Jar Compatibility Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Library Jar Compatibility" Watch "Library Jar Compatibility" New topic
Author

Library Jar Compatibility

Bimal Patel
Ranch Hand

Joined: Aug 29, 2003
Posts: 130
If I compile a set of java class files with some library jar and while running it, I specify new library jar i.e. newer version of the library jar, will that affect? I think yes but not always. Comments?


Work Hard, Expect The Worst...<br /> <br />Bimal R. Patel<br />(SCJP 1.2, SCWCD 1.4)
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24166
    
  30

The classes in the new jar will be used at runtime, of course. Whether this will work or not depends on whether the public APIs of the classes have changed. As long as the new jar includes the classes your code uses, and those classes still have the methods you called, then things will link just fine. Now, if the behavior of those methods has changed, then you might still have some problems.


[Jess in Action][AskingGoodQuestions]
Bimal Patel
Ranch Hand

Joined: Aug 29, 2003
Posts: 130
Thanks for the response. I have the similer thoughts. What about the reverse case? I mean to say, compiled with the old lib jar and running with the new lib jar? I think same problem may occur in terms of if the behaviour of a method is changed. I don't know why but I feel that at both the times, one should always have the same versions of the lib jar.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24166
    
  30

Originally posted by Bimal Patel:
I don't know why but I feel that at both the times, one should always have the same versions of the lib jar.


No, not really. If this was true, we wouldn't use jars at all -- you'd package everything into one indivisible blob to avoid this kind of problem. But being able to upgrade a libary without recompiling an application is a nice, useful, and valid thing to do.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Library Jar Compatibility
 
Similar Threads
Which of the following statements are correct regarding tag libraries?
Question about Tag lib
where is net.sf.hibernate.Session?
java.lang.ClassNotFoundException: org.apache.commons.fileupload.FileUploadException
problem with Persistence.createEntityManagerFactory