Win a copy of Real-World Software Development: A Project-Driven Guide to Fundamentals in Java this week in the Agile and Other Processes forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Bear Bibeault
  • Liutauras Vilda
  • Devaka Cooray
  • Knute Snortum
  • Junilu Lacar
  • Henry Wong
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Piet Souris

Static method and variables in 2 jars

Ranch Hand
Posts: 33
Eclipse IDE Redhat Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I have a class with static methods and static variables.  Currently this class is part of a jar file that is running every hour.
I will need to develop a new project, this new project could reuse this static class. I will also create a jar file for this new project. This project is expected to be running every 20 minutes.

My question is. If the 2 jars run at the same time, Will it be any problem if both jars are using the same class with the same static methods and variables?
Saloon Keeper
Posts: 6922
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
Saloon Keeper
Posts: 11462
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or, if the JAR is being used by two different applications running in the same application container, then the class will be loaded by a different class loader and you also won't have a problem.

Still, keep in mind that it's generally a bad idea to have static fields that aren't constants.
Doody calls. I would really rather that it didn't. Comfort me wise and sterile tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!