How to get address of a Java Object? [duplicate]

Firstly – no, you can’t get the address of an object in Java; at least, not pure Java with no debugging agent etc. The address can move over time, for one thing. You don’t need it.

Secondly, it’s slightly hard to follow your explanation but you certainly won’t be able to get away without listening for changes to the file itself. Once you’ve loaded the file into a Properties object, any later changes to the file on disk won’t be visible in that object unless you specifically reload it.

Basically you should listen for changes to the file (or poll it) and reload the file (either into a new Properties or overwriting the existing one) at that point. Quite whether you also need to listen for updates on the string container will depend on your application.

Leave a Comment