From ae01092dd6674b47af7cc170b0c1af82da917831 Mon Sep 17 00:00:00 2001 From: Kshitij Date: Wed, 6 Nov 2024 01:39:04 +0530 Subject: [PATCH] Added information about env variable, added backticks for JAVA_HOME in windows instructions. --- Codes/Group A/Assignment-A3/README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Codes/Group A/Assignment-A3/README.md b/Codes/Group A/Assignment-A3/README.md index 4bb9789..cea8072 100644 --- a/Codes/Group A/Assignment-A3/README.md +++ b/Codes/Group A/Assignment-A3/README.md @@ -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 ``` +> [!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--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: ```shell java -Djava.library.path=. A3 @@ -47,7 +50,7 @@ javac 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. ```shell 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: ```shell java -Djava.library.path=. A3 -``` \ No newline at end of file +```