0

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?

Abdullah Ilgaz
  • 719
  • 1
  • 17
  • 39
İbrahim
  • 991
  • 1
  • 10
  • 32
  • 1
    Those files are missing from the installation. See https://plus.google.com/+RikvanKekem/posts/iGH3mGNYkzP. You can download them [here](https://gist.github.com/jpluimers/e1a0b4c8523eb3adeaa17be745ac03e5). – LU RD Dec 28 '16 at 10:34
  • I downloaded the text files and I moved `java2op` directory, and when I worked same command, I get same error: `Java2OP.exe -jar ..\libmylib.jar -unit Androidapi.JNI.MyLib` `Parsing xml: C:\Program Files (x86)\Embarcadero\Studio\18.0\bin\converters\java2op\bootclasses.xml Parsing jar: ..\libmylib.jar class or Interface expected` – İbrahim Dec 28 '16 at 10:56
  • 1
    Note that `destructor` is misspelled in `ReservedWordsOP.txt`. – LU RD Dec 28 '16 at 12:12
  • Thanks, I replaced, but result is same. – İbrahim Dec 28 '16 at 12:21

1 Answers1

0

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.

  • It seems you are correct, copying `Java2OP.exe` to a non-whitespace directory and running it from there fixed the issue for me. – Elad Nava Jul 04 '17 at 20:38