37 lines
551 B
Markdown
37 lines
551 B
Markdown
|
## Steps to run this code
|
||
|
|
||
|
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.
|
||
|
|
||
|
### Prerequisites
|
||
|
|
||
|
1. open-jdk (version 11 or higher)
|
||
|
2. gcc
|
||
|
3. Common sense
|
||
|
|
||
|
### Steps
|
||
|
|
||
|
1. Compile `A3.java`:
|
||
|
```shell
|
||
|
javac A3.java
|
||
|
```
|
||
|
|
||
|
2. Generate header file:
|
||
|
```shell
|
||
|
javac -h . A3.java
|
||
|
```
|
||
|
|
||
|
3. Compile C code:
|
||
|
```shell
|
||
|
gcc -shared -o libA3.so -fPIC -I"$JAVA_HOME/include" -I"$JAVA_HOME/include/linux" A3.c
|
||
|
```
|
||
|
|
||
|
4. Run program:
|
||
|
```shell
|
||
|
java -Djava.library.path=. A3
|
||
|
```
|