Table of contents

Official Content

This article explains how you can invoke a Procedure object set as Main that uses the GAM API from the command line in a Java environment.

Setup

  • Install Java on your PC. You can follow this link and download Java if you have any version of Java already installed.

Go to Java Applications Development to see the requirements to generate in Java with GeneXus.

Call the Procedure from the KB Model:

  • Navigate to the 'Web' directory from the command line.
C:\<path_to_KB>\<your_KB>\<environment>\web>
  • Once you are there, execute java.exe with the following classpath: 
-cp build\classes\java\main;"build\libs\*"

An example of execution could be as follows:

C:\<path_to_KB>\<your_KB>\<environment>\web>"C:\Program Files\Java\jdk-11.0.15\bin\java.exe"  -cp build\classes\java\main;"build\libs\*" com.kbname.aprocmain

Note: Make sure that connection.gam and application.gam are in the directory from which you are going to run this.

If your Procedure receives parameters, they must be written at the end of the line, as shown below: 

.."build\libs\*" com.kbname.aprocmain “charAttribute” numberAttribute “charAttribute”

Pay attention to how these parameters must be written, depending on whether they are characters or numeric.

Call the Procedure from the Tomcat WebApp:

  • Navigate to the 'WEB-INF' directory from the command line:
    C:\<path_to_Tomcat>\webapps\<your_webapp>\WEB-INF>
  • Once you are there, execute java.exe with the following classpath:
    -cp classes\;"lib\*"

An example of execution could be as follows:

C:\Program Files\Apache Software Foundation\Tomcat 9.0\webapps\WebAppName\WEB-INF>"C:\Program Files\Java\jdk-11.0.17\bin\java.exe" -cp classes\;"lib\*" com.kbname.aprocmain

Note: Make sure that connection.gam and application.gam are in the directory from which you are going to run this.

If your Procedure receives parameters, they must be written at the end of the line, as shown below: 

.."build\libs\*" com.kbname.aprocmain “charAttribute” numberAttribute “charAttributte”

Pay attention to how these parameters must be written, depending on whether they are characters or numeric.

  

 

Last update: February 2025 | © GeneXus. All rights reserved. GeneXus Powered by Globant