Delphi 10.1 Berlin - Java2OP: class or interface expected

北城以北 提交于 2019-12-13 07:03:44

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/41359861/delphi-10-1-berlin-java2op-class-or-interface-expected

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!