January 20, 2017
Installed ZAPI CLOUD and wondering how to generate JWT token without using IDE
There are various ways to generate JWT Token. Java samples are available in our knowledge base. Please follow the below steps to create a JWT token using Java sample from command line without having any IDE like eclipse.
Confirm Java8 is installed and JAVA_PATH set. Check Java version installed on your machine using below command.
java version "1.8.0_111"
Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot(TM) Client VM (build 25.111-b14, mixed mode)
Download the jwt-generator.jar and sampleJwtGenerator.java save to the same location say G:\ZAPI_CLoud.
Edit the parameter values for accessKey,secretKey,userName and API in the file sampleJwtGenerator.java matching your requirement.
- Open command prompt.
- Change directory to the location of your java file downloaded above G:\ZAPI_CLoud
- Compile your java file adding the dependency jar jwt-generator.jar to classpath as shown below:
G:\ZAPI_CLoud>javac -cp ".;jwt-generator.jar" sampleJwtGenerator.java
- Now, run the class file generated using the below command
- You will get the Final API and JWT token as output
- Use the Final API and JWT Token created above to make API requests.