DLTcollab / dcurl

Hardware-accelerated Multi-threaded IOTA PoW, drop-in replacement for ccurl
MIT License
41 stars 23 forks source link

Use javac instead of javah for newer Java version #88

Closed marktwtn closed 5 years ago

marktwtn commented 5 years ago

The Java version greater than 8 removes the tool javah. It uses javac -h to replace the same functionality of javah.

The javac -h was first implemented in the Java 8.

If we use the newer version of Java, the BUILD_JNI=1 would fail in the steps of mk/java.mk.

furuame commented 5 years ago

What java version do you use would cause fail? Java 9?

marktwtn commented 5 years ago

What java version do you use would cause fail? Java 9?

Java 11.

jserv commented 5 years ago

So, we need a wrapper of javah for JDK versions greater than 8. @marktwtn, did you find JNI API changes so far?

marktwtn commented 5 years ago

I do not find other ways to use javac -h without compiling the Java file.

To make the compilation succeed, download the source code of IRI rather than the single file PearlDiver.java. If the compilation does not succeed, the native header file would no be generated.

jserv commented 5 years ago

Can we simply set JAVAH to which javah || javac -h or something similar?

furuame commented 5 years ago

The -h option in javac (Java11) actually means the native header file output directory path. It seems that we need entire iri package to produce native header file orz ...

furuame commented 5 years ago

Since the native header file is dependent on the java source code, shall we provide a latest jni header file (corresponding to the latest DLTcollab/iri) online rather than built by user?

wusyong commented 5 years ago

Isn't iri only compatible with Java 8 atm?

marktwtn commented 5 years ago

Isn't iri only compatible with Java 8 atm?

Yes, according to the readme.md of IRI:

Make sure to have Maven and Java 8 installed on your computer.
marktwtn commented 5 years ago

I accidentally found out the issue while I was using the Java 11.

In the readme.md of IRI, it says Make sure to have Java 8 installed on your computer. However, the Java version is not specified in the readme.md of dcurl.

Here are the possible solutions:

  1. Specify the required Java version in readme.md
  2. Provide a latest JNI header file online rather than generate from user.
  3. Download the whole IRI package and use javac to generate the JNI header file.