From c8304d11c5267e3855a6c87cc3041453825360f4 Mon Sep 17 00:00:00 2001 From: Tanmay Date: Mon, 4 Nov 2024 19:23:20 +0530 Subject: [PATCH] added manual for running a-3 (DLL) for windows --- Codes/Group A/Assignment-A3/README.md | 34 ++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/Codes/Group A/Assignment-A3/README.md b/Codes/Group A/Assignment-A3/README.md index 598df93..4bb9789 100644 --- a/Codes/Group A/Assignment-A3/README.md +++ b/Codes/Group A/Assignment-A3/README.md @@ -5,15 +5,16 @@ These are the steps to run code for Assignment-A3. --- > [!IMPORTANT] -> I've tested this on Linux, thus I've included instructions for the same. +> Tested on Linux and Windows. ### Prerequisites 1. open-jdk (version 11 or higher) 2. gcc -3. Common sense +3. Set open-jdk and gcc as environment variables using bin folder in path (For Windows Users only) +4. Common sense -### Steps +### Steps For Linux 1. Compile `A3.java`: ```shell @@ -34,3 +35,30 @@ gcc -shared -o libA3.so -fPIC -I"$JAVA_HOME/include" -I"$JAVA_HOME/include/linux ```shell java -Djava.library.path=. A3 ``` +### Steps For Windows + +1. Compile `A3.java`: +```shell +javac A3.java +``` + +2. Generate header file: +```shell +javac -h . A3.java +``` + +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 +``` + +4. Compile C code: +```shell +gcc -shared -o A3.dll -fPIC -I"%JAVA_HOME%\include" -I"%JAVA_HOME%\include\win32" A3.c +``` + +5. Run program: +```shell +java -Djava.library.path=. A3 +``` \ No newline at end of file