I have a GlassFish/j2ee application, and I develop on one box, and production is a remote box.
I have a function that makes files, and I need the files’ location to be different based on my dev box or production.
What is an automatic way to do the switching so I do not have to edit the source file based on where it is being deployed?
I have a GlassFish/j2ee application, and I develop on one box, and production is
Share
The easiest approach is to define a system property which specifies where the file system location for your data is. The production appserver would define one value (using
java -Din the startup script), and your dev app server would define another value. Your application source would consult the system property value (usingSystem.getProperty()) to discover the appropriate location.