Skip to content

Commit 5db0caf

Browse files
committed
docs: update java sdk documents
Signed-off-by: peefy <[email protected]>
1 parent 9d94c69 commit 5db0caf

File tree

1 file changed

+44
-1
lines changed

1 file changed

+44
-1
lines changed

README.md

+44-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,50 @@ func main() {
5252

5353
### Java
5454

55-
See [here](https://github.com/kcl-lang/kcl-java) for more information.
55+
Refer to [this](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-apache-maven-registry#authenticating-to-github-packages) to configure your Maven; set up your GitHub account and Token in the `settings.xml`.
56+
57+
#### Maven
58+
59+
In your project's pom.xml, configure our repository as follows:
60+
61+
```xml
62+
<repositories>
63+
<repository>
64+
<id>github</id>
65+
<url>https://maven.pkg.github.com/kcl-lang/*</url>
66+
<snapshots>
67+
<enabled>true</enabled>
68+
</snapshots>
69+
</repository>
70+
</repositories>
71+
```
72+
73+
This way you'll be able to import the above dependency to use the SDK.
74+
75+
```xml
76+
<dependency>
77+
<groupId>com.kcl</groupId>
78+
<artifactId>kcl-lib</artifactId>
79+
<version>0.8.6</version>
80+
</dependency>
81+
```
82+
83+
Write the code
84+
85+
```java
86+
import com.kcl.api.API;
87+
import com.kcl.api.Spec.ExecProgram_Args;
88+
import com.kcl.api.Spec.ExecProgram_Result;
89+
90+
public class ExecProgramTest {
91+
public static void main(String[] args) throws Exception {
92+
API api = new API();
93+
ExecProgram_Result result = api
94+
.execProgram(ExecProgram_Args.newBuilder().addKFilenameList("path/to/kcl.k").build());
95+
System.out.println(result.getYamlResult());
96+
}
97+
}
98+
```
5699

57100
### Python
58101

0 commit comments

Comments
 (0)