Java run-time properties
An EGL-generated Java program uses a set of run-time properties that provide information such as how to access the databases and files that are used by the program.
In a J2EE environment
In relation to a generated Java program that will run in a J2EE environment, these situations are possible:
- EGL can generate the run-time properties directly into a J2EE deployment descriptor. In this case, EGL overwrites properties that already exist and appends properties that do not exist. The program accesses the J2EE deployment descriptor at run time.
- Alternatively, EGL can generate the run-time properties into a J2EE environment file. You can customize the properties in that file, then copy them into the J2EE deployment descriptor.
- You can avoid generating the run-time properties at all, in which case write any needed properties by hand.
In a J2EE module, every program has the same run-time properties because all code in the module shares the same deployment descriptor.
In a non-J2EE Java environment
In relation to a generated Java program that runs outside of a J2EE environment, you can generate the run-time properties into a program properties file or code that file by hand. (The program properties file provides the kind of information that is available in the deployment descriptor, but the format of the properties is different.)
In a non-J2EE Java environment, properties can be specified in these two program properties files:
- rununit.properties; and
- A file named as follows--
programName.properties
- programName
- The first program in the run unit
If a same-named property is set in both files, the property in the file named for the program is used.
Use of rununit.properties is especially appropriate when the first program of a run unit does not access a file or database but calls programs that do:
- When generating the caller, you can generate a properties file named for the program, and the content might include no database- or file-related properties
- When you generate the called program, you can generate rununit.properties, and the content would be available for both programs
Neither file is mandatory, and simple programs do not need either one.
At deployment time, these rules apply:
- The global properties file (rununit.properties, if present) must be with the program, in a directory that is specified in the classpath.
- The location of a program properties file (if present) depends on whether the program is in a package. The rules are best illustrated by example:
- If program P is in package x.y.z and is deployed to MyProject/JavaSource, the program properties file must be in MyProject/JavaSource/x/y/z
- If program P is not in a package and is deployed to myProject/JavaSource, the program properties file (like the global properties file) must be in MyProject/JavaSource
In either case, MyProject/JavaSource must be in the classpath.
If you generate output to a Java project, EGL places the properties files in the appropriate folders.
If you are generating Java code for use in the same run-unit as Java code generated with an earlier version of EGL or VisualAge Generator, the rules for deploying properties file depends on whether the first program in the run unit was generated with EGL 6.0 or later (in which case the rules described here apply) or whether the first program was generated with an earlier version of EGL or VisualAge Generator (in which case the properties files can be in any directory in the classpath, and the global file is called vgj.properties).
Finally, if the first program was generated with the earlier software, you can specify an alternate properties file, which is used throughout the run unit in place of any non-global program properties files. For details, see the description of property vgj.properties.file in Java run-time properties (details).
Build descriptors and program properties
Your choices are submitted to EGL as build-descriptor-option values:
- To generate properties into a J2EE deployment descriptor, set J2EE to YES; set genProperties to PROGRAM or GLOBAL; and generate into a J2EE project.
- To generate properties into a J2EE environment file, set J2EE to YES; set genProperties to PROGRAM or GLOBAL; and do either of these:
- Generate into a directory (in which case you use the build descriptor option genDirectory rather than genProject); or
- Generate into a non-J2EE project.
- To generate a program properties file with the same name as the program being generated, set J2EE to NO; set genProperties to PROGRAM; and generate into a project other than a J2EE project.
- To generate a program properties file rununit.properties, set J2EE to NO; set genProperties to GLOBAL; and generate into a project other than a J2EE project.
- To avoid generating properties, set genProperties to NO.
For additional information
For details on generating properties into a deployment descriptor or into a J2EE environment file, see Setting deployment-descriptor values.
For details on the meaning of the run-time properties, see Java run-time properties (details).
Related concepts
EGL debugger
Generation of Java code into a project
J2EE environment file
Program properties file
Run unit
Related tasks
Processing Java code that is generated into a directory
Setting up the J2EE run-time environment for EGL-generated code
Setting deployment-descriptor values
Updating the deployment descriptor manually
Updating the J2EE environment file
Related reference
genProperties
J2EE
Java run-time properties (details)