1. Installation of Java runtime
Please note, that this installation step is shared with the installation of excelExporter, comFramework’s auxiliary code generator. You don’t need to do this twice, if you are going to use both tools.
The code generator belonging to project comFramework is a stand-alone Java
application. An installed Java runtime environment of version 8 (aka 1.8)
or higher is a prerequisite of running the code generator. If such a Java
RTE is in your system’s search path for executables then you can skip this
step. Even setting environment variable COMFRAMEWORK_JAVA_HOME
(see
below) is not a must; if you don’t do then the Java executable from the
search path will be used.
If no suitable Java RTE is available in your system’s search path, then you can get an appropriate Java Open JDK at https://jdk.java.net/23/ (Nov 2024). Download the archive (e.g., https://download.java.net/java/GA/jdk23.0.1/c28985cbf10d4e648e4004050f8781aa/11/GPL/openjdk-23.0.1_windows-x64_bin.zip for Windows x64 users).
Unzip the Java archive to a location of your choice and consider adding
this location to the operating system’s search path. Either the Java
executable, java.exe, needs to be in the Windows search path or the Java
installation path — where bin\java.exe
is located in — is assigned to
a new environment variable COMFRAMEWORK_JAVA_HOME
. Given, you’re Java
executable would be c:\ProgramFiles\jdk-23.0.1\bin\java.exe
, then you
could issue the command:
setx COMFRAMEWORK_JAVA_HOME c:\ProgramFiles\jdk-23.0.1
from a Command Prompt window. Please note, that the proposed command will install the new environment variable only for the current user. A machine wide setting by putting /m at the end of the command line requires administrator rights.
2. Unzip the comFramework archive
If not already done for the installation of excelExporter, you would now unzip the comFramework archive to a location of your choice. Installation paths containing blanks must be avoided.
The installation path of comFramework’s code generator (i.e., a path like
…\comFramework\codeGenerator
, where folder dist
is located in) is
assigned to a new environment variable COMFRAMEWORK_CODEGENERATOR_HOME
.
The script that launches the Java application, will set the Java class
path based on this root directory. Java will fail to locate the required
jar files if the environment variable is not properly set. Given, you’d
copied the archive’s contents to the folder c:\ProgramFiles
, then you
could issue the command:
setx COMFRAMEWORK_CODEGENERATOR_HOME c:\ProgramFiles\comFramework\codeGenerator
from a Command Prompt window. Please note, that the proposed command will install the new environment variable only for the current user. A machine wide setting by putting /m at the end of the command line requires administrator rights.
The application launcher is a Windows script named codeGenerator.cmd
. It
is located in the folder codeGenerator\dist
. It’s a very simple script
and Linux and Mac OS users won’t have any problems to write the same
script in their respective shell script languages. The script becomes most
useful if the folder dist is added to the system search path (i.e.,
environment variable PATH
would be extended by
c:\ProgramFiles\comFramework\codeGenerator\dist
in the example above).
Consider typing:
pathman /au c:\ProgramFiles\comFramework\codeGenerator\dist
in a Command Prompt window. Please note, that the proposed command will
extend the Windows search path only for the current user. A machine wide
setting by putting /as
instead of /au
requires administrator rights.
Alternatively, the tiny script codeGenerator.cmd
can be copied to all
locations where the code generator is about to be used.
3. Test your installation
If you decided to extend your PATH
variable then you should test your
installation by opening a new shell window — the Windows configuration
settings made by commands setx
and pathman
are not adopted by the
shell instance, which they are submitted from. In the new shell, cd
to
an arbitrary working directory and submit the command:
codeGenerator.cmd --help
The application should start up and it should respond with its usage text.
From the same shell, cd
to sample raceTechnology
, i.e., folder
…\codeGenerator\samples\raceTechnology
. Type:
generateCode
generateCode
is a small wrapper script with the command line appropriate
for this sample. The code generator is run and should properly reproduce
the generated files, which already were in the ZIP archive. Inspect folder
output
to see.