Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: update Java interop document #5783

Merged
merged 4 commits into from
May 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 4 additions & 9 deletions src/content/interop/java-interop.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,8 @@ that uses `package:jnigen` to generate bindings for a simple class.

- JDK
- [Maven][]
- (Optional) [`clang-format`][] to format the generated C bindings

[Maven]: https://maven.apache.org/
[`clang-format`]: https://clang.llvm.org/docs/ClangFormat.html

### Configure `jnigen`

Expand All @@ -56,9 +54,6 @@ This file contains the configuration for generating the bindings.

```yaml
output:
c:
library_name: example
path: src/example/
dart:
path: lib/example.dart
structure: single_file
Expand All @@ -69,7 +64,7 @@ classes:
- 'dev.dart.Example'
```

`path` specifies the path for the generated `c` and `dart` bindings.
`path` specifies the path for the generated `dart` bindings.

`source_path` specifies the path of the Java source file that
you want to generate bindings for,
Expand All @@ -90,7 +85,7 @@ public class Example {

### Generate the Dart bindings

To generate the Dart (and C) bindings, run `jnigen` and
To generate the Dart bindings, run `jnigen` and
specify the config file using the `--config` option:

```console
Expand Down Expand Up @@ -120,11 +115,11 @@ print(Example.sum(a, b));
### Run the example

Before running the example,
you must build the dynamic libraries for `jni` and the generated C files.
you must build the dynamic library for `jni`.
The Java sources also must be compiled. To do so, run:

```console
$ dart run jni:setup -p jni -s src/example
$ dart run jni:setup
$ javac java/dev/dart/Example.java
```

Expand Down