• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

Do we Recompile the java file if rt.jar is changed?

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In our production env they have done some security patch update and new rt.jar file is used for this.
Do we require to recompile our java code for this new rt.jar file and deploy in server?
Or it is enough to restart the webserver?

Please provide your valuable inputs...........
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It depends. It's safer to recompile your code with the new JAR.

One thing that can go wrong is the following. The Java compiler inlines the values of static final variables (as they are constants). Suppose that you have a class One that looks like this, inside some JAR file that you are using:

Suppose you have your own class Two which uses VALUE:

The compiler will replace the One.VALUE with the actual value 123 - it will not make class Two refer to class One to get the value. That means that if you replace class One with a new version:


and then run class Two without recompiling it, you will still see the old value 123 being printed!
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am not really sure the original poster is talking about changes to some random jar files of the application.

In our production env they have done some security patch update and new rt.jar file is used for this.
Do we require to recompile our java code for this new rt.jar file and deploy in server?



I'm guessing he's talking about the Java Runtime's rt.jar file. Changes to that JRE's rt.jar shouldn't require a recompile of the application. Just a server restart should be fine.
 
Ranch Hand
Posts: 174
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I agree with Jaikiran. You should not require any recompilation of your application.
 
When people don’t understand what you are doing they call you crazy. But this tiny ad just doesn't care:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic