Skip to content

Commit ca7e29a

Browse files
Add platform-specific instructions for running API Dash-generated Java
Add platform-specific instructions for running API Dash-generated Java code using AsyncHttpClient, HttpClient, OkHttp3, and Unirest libraries.
1 parent 7c451e1 commit ca7e29a

File tree

1 file changed

+169
-4
lines changed

1 file changed

+169
-4
lines changed

doc/user_guide/instructions_to_run_generated_code.md

Lines changed: 169 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,19 +79,184 @@ TODO
7979

8080
## Java (asynchttpclient)
8181

82-
TODO
82+
Here are the detailed instructions for running the generated API Dash code in **Java (using `AsyncHttpClient`)** for macOS, Windows, and Linux:
83+
84+
---
85+
86+
### **1. Install Java**
87+
To run Java code, you need to have Java Development Kit (JDK) installed on your system.
88+
89+
- Visit the official **[Java Downloads Page](https://www.oracle.com/in/java/technologies/downloads/#jdk23)** and follow the instructions to install the latest JDK on macOS, Windows, or Linux.
90+
91+
After installation, verify it by running:
92+
```bash
93+
java -version
94+
```
95+
96+
---
97+
98+
### **2. Add the `AsyncHttpClient` Library**
99+
To use the `AsyncHttpClient` library in Java, you need to add it as a dependency in your project.
100+
101+
#### Using **Maven**:
102+
1. Add the following dependency to your `pom.xml` file:
103+
```xml
104+
<dependencies>
105+
<dependency>
106+
<groupId>org.asynchttpclient</groupId>
107+
<artifactId>async-http-client</artifactId>
108+
<version>3.0.1</version>
109+
</dependency>
110+
</dependencies>
111+
```
112+
3. Save the file and run:
113+
```bash
114+
mvn install
115+
```
116+
117+
#### Using **Gradle**:
118+
1. Add the following line to the `dependencies` section in your `build.gradle` file:
119+
```gradle
120+
implementation 'org.asynchttpclient:async-http-client:3.0.1'
121+
```
122+
2. Run the following command to fetch the dependency:
123+
```bash
124+
gradle build
125+
```
126+
127+
---
128+
129+
### **3. Run the Generated Code**
130+
After setting up Java and adding the `AsyncHttpClient` library, follow these steps to execute the generated code:
131+
132+
1. **Create a new Java file**: Save the generated code into a file with a `.java` extension, such as `ApiTest.java`.
133+
2. **Compile the file**: Use the following command in the terminal:
134+
```bash
135+
javac ApiTest.java
136+
```
137+
3. **Run the compiled program**:
138+
```bash
139+
java ApiTest
140+
```
141+
142+
---
83143

84144
## Java (HttpClient)
85145

86-
TODO
146+
Here are the detailed instructions for running the generated API Dash code in **Java (using `HttpClient`)** for macOS, Windows, and Linux:
147+
148+
---
149+
150+
### **1. Install Java**
151+
👉 Follow the instructions provided above under **Java (AsyncHttpClient)** for detailed steps on how to install the Java Development Kit (JDK) on macOS, Windows, or Linux.
152+
153+
---
154+
155+
### **2. `HttpClient` Setup**
156+
The `HttpClient` library is included as part of the **Java SE 11** (or later) standard library.
157+
- Ensure you have **Java 11** or a later version installed to use `HttpClient` without needing additional dependencies.
158+
159+
160+
To confirm your Java version, run:
161+
```bash
162+
java -version
163+
```
164+
---
165+
166+
### **3. Run the Generated Code**
167+
👉 Refer to the instructions above under **Java (AsyncHttpClient)** for steps to save, compile, and execute the Java code.
168+
169+
---
87170

88171
## Java (okhttp3)
89172

90-
TODO
173+
Here are the detailed instructions for running the generated API Dash code in **Java (using `okhttp3`)** for macOS, Windows, and Linux:
174+
175+
---
176+
177+
### **1. Install Java**
178+
👉 Follow the instructions provided above under **Java (AsyncHttpClient)** for detailed steps on how to install the Java Development Kit (JDK) on macOS, Windows, or Linux.
179+
180+
---
181+
182+
### **2. Add the `okhttp3` Library**
183+
To use `okhttp3` in Java, you need to add it as a dependency in your project.
184+
185+
#### Using **Maven**:
186+
1. Add the following dependency to your `pom.xml` file:
187+
```xml
188+
<dependency>
189+
<groupId>com.squareup.okhttp3</groupId>
190+
<artifactId>okhttp</artifactId>
191+
<version>4.12.0</version>
192+
</dependency>
193+
```
194+
2. Save the file and run:
195+
```bash
196+
mvn install
197+
```
198+
199+
#### Using **Gradle**:
200+
1. Add the following line to the `dependencies` section in your `build.gradle` file:
201+
```gradle
202+
implementation 'com.squareup.okhttp3:okhttp:4.12.0'
203+
```
204+
2. Run the following command to fetch the dependency:
205+
```bash
206+
gradle build
207+
```
208+
209+
---
210+
211+
### **3. Run the Generated Code**
212+
👉 Refer to the instructions provided above under **Java (AsyncHttpClient)** for steps to save, compile, and execute the Java code.
213+
214+
---
91215

92216
## Java (Unirest)
93217

94-
TODO
218+
Here are the detailed instructions for running the generated API Dash code in **Java (using `Unirest`)** for macOS, Windows, and Linux:
219+
220+
---
221+
222+
### **1. Install Java**
223+
👉 Follow the instructions provided above under **Java (AsyncHttpClient)** for detailed steps on how to install the Java Development Kit (JDK) on macOS, Windows, or Linux.
224+
225+
---
226+
227+
### **2. Add the `Unirest` Library**
228+
To use `Unirest` in Java, you need to add it as a dependency in your project.
229+
230+
#### Using **Maven**:
231+
1. Add the following dependency to your `pom.xml` file:
232+
```xml
233+
<dependency>
234+
<groupId>com.konghq</groupId>
235+
<artifactId>unirest-java</artifactId>
236+
<version>3.14.1</version>
237+
</dependency>
238+
```
239+
2. Save the file and run:
240+
```bash
241+
mvn install
242+
```
243+
244+
#### Using **Gradle**:
245+
1. Add the following line to the `dependencies` section in your `build.gradle` file:
246+
```gradle
247+
implementation 'com.konghq:unirest-java:3.14.1'
248+
```
249+
2. Run the following command to fetch the dependency:
250+
```bash
251+
gradle build
252+
```
253+
254+
---
255+
256+
### **3. Run the Generated Code**
257+
👉 Refer to the instructions provided above under **Java (AsyncHttpClient)** for steps to save, compile, and execute the Java code.
258+
259+
---
95260

96261
## Julia (HTTP)
97262

0 commit comments

Comments
 (0)