How do I run the SDK example smjavaagentapi with a 5.x agent

Document ID : KB000095729
Last Modified Date : 06/06/2018
Show Technical Document Details
Question:
Compile and run example "CA/sdk/samples64/smjavaagentapi"

messages:

5.x Agent Interface(smreghost utility must be run before it)" 
FATAL: GetConfig method returned error. Check agentName & SmHost.conf file path is correct 

Could you please provide documentation or some kind of implementation/configuration guide to successfully run the SDK example to connect to the policy server?
Answer:
To run the SDK Agent sample correctly you need to do the following:

5.x Agent Model:

1) You will need to setup an agent on the Policy Server.
    Create Agent in WAMUI
    Enter Agent name as "jsdksample-agent"
2) Run a registration with smreghost.exe to generate an SmHost.conf file.
3) Place this file in the path that is defined in the smjsdkexample.properties file with the property HOSTCONFPATH
4) You should now be able to make a connection to the Policy server defined in the SmHost.conf path