Added information about env variable, added backticks for JAVA_HOME in windows instructions.
This commit is contained in:
parent
9296a4bd14
commit
ae01092dd6
@ -31,6 +31,9 @@ javac -h . A3.java
|
|||||||
gcc -shared -o libA3.so -fPIC -I"$JAVA_HOME/include" -I"$JAVA_HOME/include/linux" A3.c
|
gcc -shared -o libA3.so -fPIC -I"$JAVA_HOME/include" -I"$JAVA_HOME/include/linux" A3.c
|
||||||
```
|
```
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> If you get an error saying _"fatal error: jni.h: No such file or directory"_, this might be because you haven't set `$JAVA_HOME` environment variable. Usually JVM stuff is in `/usr/lib/jvm/java-<version>-openjdk-amd64`. To set `JAVA_HOME` environment variable, run: `export $JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64` (for version 17, adjust for your version accordingly.)
|
||||||
|
|
||||||
4. Run program:
|
4. Run program:
|
||||||
```shell
|
```shell
|
||||||
java -Djava.library.path=. A3
|
java -Djava.library.path=. A3
|
||||||
@ -47,7 +50,7 @@ javac A3.java
|
|||||||
javac -h . A3.java
|
javac -h . A3.java
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Set JAVA_HOME to the path of your jdk file location:
|
3. Set `JAVA_HOME` to the path of your jdk file location:
|
||||||
> Note that this is my file location for jdk. It may differ for you.
|
> Note that this is my file location for jdk. It may differ for you.
|
||||||
```shell
|
```shell
|
||||||
set JAVA_HOME=C:\Program Files\openjdk-23.0.1_windows-x64_bin\jdk-23.0.1
|
set JAVA_HOME=C:\Program Files\openjdk-23.0.1_windows-x64_bin\jdk-23.0.1
|
||||||
@ -61,4 +64,4 @@ gcc -shared -o A3.dll -fPIC -I"%JAVA_HOME%\include" -I"%JAVA_HOME%\include\win32
|
|||||||
5. Run program:
|
5. Run program:
|
||||||
```shell
|
```shell
|
||||||
java -Djava.library.path=. A3
|
java -Djava.library.path=. A3
|
||||||
```
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user