Unofficial Content

This article describes the steps you must follow to be able to execute Main Objects through command line, when using the GeneXus Java Generator.

  1. The first step is to go (via command line) to the root directory of the environment.
  2. The second step is to execute the following command:

    "<JavaPath>\bin\java.exe" -cp <classpath> <NameSpace>.a<MainObject>


                 Path where the Java version is installed. 

    Path where the compiled files of the classes are located. In this case, the path is:

    Name of the NameSpace being used in the project. This value depends on the specific project you are working on.

    Name of the main object that you want to execute.


Imagine that you have installed JDK 18 version in the folder C:\Program Files\Java\jdk- 

In addition, you have defined the name of your Knowledge Base to be SampleKB. So, its Java environment root directory is C:\Models\SampleKB\JavaModel.

Sample #1

Suppose you have defined a Procedure object called InsertCustomer, to which you have set the Main program property = True and Call protocol property = Command Line. Then, the command to execute the InsertCustomer Procedure is as follows:

C:\Models\SampleKB\JavaModel>"C:\Program Files\Java\jdk-\bin\java.exe" -cp web\build\classes\java\main;"web\build\libs\*" com.samplekb.ainsertcustomer

See Also

Compilation process with the Java Generator

Last update: April 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant