Skip to content

Commit

Permalink
Add pom.xml and fix deprecation issues
Browse files Browse the repository at this point in the history
  • Loading branch information
radare committed Dec 8, 2024
1 parent 4523ee0 commit 8fedd07
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 5 deletions.
12 changes: 9 additions & 3 deletions java/Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
JARPATH=$(shell pwd)
JAVASRC=src/main/java/org/radare/r2pipe
JAVAC?=javac
include config.mk

all:
javac $(JAVACFLAGS) org/radare/r2pipe/*.java examples/Test.java
jar cvf r2pipe.jar org
$(MAKE) -C jni
$(JAVAC) $(JAVACFLAGS) $(JAVASRC)/*.java examples/Test.java
cd src/main/java && jar cvf ../../../r2pipe.jar org
# $(MAKE) -C jni
$(MAKE) -C examples

maven:
mvn clean compile
mvn install

run:
$(MAKE) -C examples run

Expand Down
2 changes: 1 addition & 1 deletion java/jni/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ JNIFLAGS+=-I /System/Library/Frameworks/JavaVM.framework/Headers/
all: $(JVH)
$(CC) -o $(OUT) -dynamiclib -fPIC $(JNIFLAGS) r2pipe-jni.c -framework JavaVM

$(JVH): ../org/radare/r2pipe/R2PipeJNI.class
$(JVH): ../src/main/java/org/radare/r2pipe/R2PipeJNI.class
javah -cp ../r2pipe.jar -d . org.radare.r2pipe.R2PipeJNI

clean:
Expand Down
40 changes: 40 additions & 0 deletions java/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<!-- Project Details -->
<groupId>org.radare</groupId>
<artifactId>r2pipe</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>

<dependencies>
<dependency>
<groupId>javax.json</groupId>
<artifactId>javax.json-api</artifactId>
<version>1.1.4</version> <!-- Check the latest version -->
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.json</artifactId>
<version>1.1.4</version>
</dependency>
</dependencies>

<!-- Build Configuration -->
<build>
<plugins>
<!-- Compiler Plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<configuration>
<source>11</source> <!-- Set the Java version -->
<target>11</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
import java.net.*;

// java7
import javax.json.*;
import javax.json.Json;
import javax.json.JsonObject;
import javax.json.JsonReader;
// import jakarta.json.Json;
// import jakarta.json.JsonObject;

public class R2Pipe {
private boolean viaHttp;
Expand Down Expand Up @@ -90,9 +94,11 @@ public String httpCmd(String str) {
return output;
}

/*
protected void finalize() throws Throwable {
quit();
}
*/

public void quit() throws Exception {
if (!viaHttp) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ public String cmd(String str) throws Exception {
return r2pipeCmd(this.core, str);
}

/*
protected void finalize() throws Throwable {
quit();
}
*/

public void quit() throws Exception {
r2pipeFree(this.core);
Expand Down

0 comments on commit 8fedd07

Please sign in to comment.