I'm using Delphi 10.1 Berlin. I want to call Java codes from Delphi. So, I created JAR file in Android Studio (this link helped to me). Then I opened Java2OP.exe from C:\Program Files (x86)\Embarcadero\Studio\18.0\bin\converters\java2op directory. I moved the jar file to this directory. Then I worked this commands in CMD:

SET PATH=%PATH%;"C:\Program Files\Java\jdk1.8.0_60\bin"

Java2OP.exe -jar ..\libmylib.jar -unit ..\Androidapi.JNI.MyLib

But I get this error:

Warning: error opening ReservedWordsOP.txt

Warning: error opening ReservedWordsC.txt

Parsing xml: C:\Program Files (x86)\Embarcadero\Studio\18.0\bin\converters\java2op\bootclasses.xml

Parsing jar: ..\libmylib.jar

class or Interface expected

This my Java class for JAR:

public class Test

{

public String work()

{

return "Hello World!";

}

}

Also I tried different Java codes, but result is same. How can I solve this problem?

解决方案

I have the same problem, and solved it removing spaces from path files.

Probably the Java2OP is calling the Java passing the path without quotes.

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐