Skip to content

Commit 7a48093

Browse files
authored
Merge pull request #537 from AffanShaikhsurab/patch-7
Add platform-specific instructions for running API Dash-generated Java
2 parents 5739c3f + d0767d8 commit 7a48093

File tree

1 file changed

+210
-4
lines changed

1 file changed

+210
-4
lines changed

doc/user_guide/instructions_to_run_generated_code.md

Lines changed: 210 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -307,19 +307,225 @@ node app.js
307307

308308
## Java (asynchttpclient)
309309

310-
TODO
310+
Here are the detailed instructions for running the generated API Dash code in **Java (using `AsyncHttpClient`)** for macOS, Windows, and Linux:
311+
312+
### 1. Install Java
313+
314+
To run Java code, you need to have Java Development Kit (JDK) installed on your system.
315+
316+
- 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.
317+
318+
After installation, verify it by running:
319+
320+
```bash
321+
java -version
322+
```
323+
324+
### 2. Add the `AsyncHttpClient` Library
325+
326+
To use the `AsyncHttpClient` library in Java, you need to add it as a dependency in your project.
327+
328+
#### Using Maven
329+
330+
1. Add the following dependency to your `pom.xml` file:
331+
```xml
332+
<dependencies>
333+
<dependency>
334+
<groupId>org.asynchttpclient</groupId>
335+
<artifactId>async-http-client</artifactId>
336+
<version>3.0.1</version>
337+
</dependency>
338+
</dependencies>
339+
```
340+
2. Save the file and run:
341+
```bash
342+
mvn install
343+
```
344+
345+
#### Using Gradle
346+
347+
1. Add the following line to the `dependencies` section in your `build.gradle` file:
348+
```gradle
349+
implementation 'org.asynchttpclient:async-http-client:3.0.1'
350+
```
351+
2. Run the following command to fetch the dependency:
352+
```bash
353+
gradle build
354+
```
355+
356+
### 3. Run the Generated Code
357+
358+
After setting up Java and adding the `AsyncHttpClient` library, follow these steps to execute the generated code:
359+
360+
1. **Create a new Java file**: Save the generated code into a file with a `.java` extension, such as `ApiTest.java`.
361+
2. **Compile the file**: Use the following command in the terminal:
362+
```bash
363+
javac ApiTest.java
364+
```
365+
3. **Run the compiled program**:
366+
```bash
367+
java ApiTest
368+
```
311369

312370
## Java (HttpClient)
313371

314-
TODO
372+
Here are the detailed instructions for running the generated API Dash code in **Java (using `HttpClient`)** for macOS, Windows, and Linux:
373+
374+
### 1. Install Java
375+
376+
To run Java code, you need to have Java Development Kit (JDK) installed on your system.
377+
378+
- 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.
379+
380+
After installation, verify it by running:
381+
382+
```bash
383+
java -version
384+
```
385+
386+
### 2. `HttpClient` Setup
387+
388+
The `HttpClient` library is included as part of the **Java SE 11** (or later) standard library.
389+
- Ensure you have **Java 11** or a later version installed to use `HttpClient` without needing additional dependencies.
390+
391+
To confirm your Java version, run:
392+
```bash
393+
java -version
394+
```
395+
396+
### 3. Run the Generated Code
397+
398+
After setting up Java and checking the version, follow these steps to execute the generated code:
399+
400+
1. **Create a new Java file**: Save the generated code into a file with a `.java` extension, such as `ApiTest.java`.
401+
2. **Compile the file**: Use the following command in the terminal:
402+
```bash
403+
javac ApiTest.java
404+
```
405+
3. **Run the compiled program**:
406+
```bash
407+
java ApiTest
408+
```
315409

316410
## Java (okhttp3)
317411

318-
TODO
412+
Here are the detailed instructions for running the generated API Dash code in **Java (using `okhttp3`)** for macOS, Windows, and Linux:
413+
414+
### 1. Install Java
415+
416+
To run Java code, you need to have Java Development Kit (JDK) installed on your system.
417+
418+
- 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.
419+
420+
After installation, verify it by running:
421+
422+
```bash
423+
java -version
424+
```
425+
426+
### 2. Add the `okhttp3` Library
427+
428+
To use `okhttp3` in Java, you need to add it as a dependency in your project.
429+
430+
#### Using Maven
431+
432+
1. Add the following dependency to your `pom.xml` file:
433+
```xml
434+
<dependency>
435+
<groupId>com.squareup.okhttp3</groupId>
436+
<artifactId>okhttp</artifactId>
437+
<version>4.12.0</version>
438+
</dependency>
439+
```
440+
2. Save the file and run:
441+
```bash
442+
mvn install
443+
```
444+
445+
#### Using Gradle
446+
447+
1. Add the following line to the `dependencies` section in your `build.gradle` file:
448+
```gradle
449+
implementation 'com.squareup.okhttp3:okhttp:4.12.0'
450+
```
451+
2. Run the following command to fetch the dependency:
452+
```bash
453+
gradle build
454+
```
455+
456+
### 3. Run the Generated Code
457+
458+
After setting up Java and adding the `okhttp3` library, follow these steps to execute the generated code:
459+
460+
1. **Create a new Java file**: Save the generated code into a file with a `.java` extension, such as `ApiTest.java`.
461+
2. **Compile the file**: Use the following command in the terminal:
462+
```bash
463+
javac ApiTest.java
464+
```
465+
3. **Run the compiled program**:
466+
```bash
467+
java ApiTest
468+
```
319469

320470
## Java (Unirest)
321471

322-
TODO
472+
Here are the detailed instructions for running the generated API Dash code in **Java (using `Unirest`)** for macOS, Windows, and Linux:
473+
474+
### 1. Install Java
475+
476+
To run Java code, you need to have Java Development Kit (JDK) installed on your system.
477+
478+
- 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.
479+
480+
After installation, verify it by running:
481+
482+
```bash
483+
java -version
484+
```
485+
486+
### 2. Add the `Unirest` Library
487+
488+
To use `Unirest` in Java, you need to add it as a dependency in your project.
489+
490+
#### Using Maven
491+
492+
1. Add the following dependency to your `pom.xml` file:
493+
```xml
494+
<dependency>
495+
<groupId>com.konghq</groupId>
496+
<artifactId>unirest-java</artifactId>
497+
<version>3.14.1</version>
498+
</dependency>
499+
```
500+
2. Save the file and run:
501+
```bash
502+
mvn install
503+
```
504+
505+
#### Using Gradle
506+
507+
1. Add the following line to the `dependencies` section in your `build.gradle` file:
508+
```gradle
509+
implementation 'com.konghq:unirest-java:3.14.1'
510+
```
511+
2. Run the following command to fetch the dependency:
512+
```bash
513+
gradle build
514+
```
515+
516+
### 3. Run the Generated Code
517+
518+
After setting up Java and adding the `Unirest` library, follow these steps to execute the generated code:
519+
520+
1. **Create a new Java file**: Save the generated code into a file with a `.java` extension, such as `ApiTest.java`.
521+
2. **Compile the file**: Use the following command in the terminal:
522+
```bash
523+
javac ApiTest.java
524+
```
525+
3. **Run the compiled program**:
526+
```bash
527+
java ApiTest
528+
```
323529

324530
## Julia (HTTP)
325531

0 commit comments

Comments
 (0)