我的目标是使用Embarcadero的Java2OP tool将Java项目(3 .java
个文件)翻译为.pas
个文件。
我通过cmd
使用它,从java2op
目录开始。经过几次不成功的尝试,以及大量的谷歌搜索时间,我很沮丧。
文档中的命令:
Input Options ------------- -classes Space-separated list of names of classes or packages to export. -classes lets you define a specific subset of the specified Java sources (-jar or -source options) or the Android API. -jar Space-separated list of input Java compiled libraries (.jar files). -source Space-separated list of input folders containing Java source files (.java files). Output Options -------------- -unit File name of the output unit. Default: Android.JNI.Interfaces Examples -------- Exporting some classes and packages from the Android API: Java2OP.exe -classes android.net.ConnectivityManager android.location.* Exporting all classes from mylib.jar: Java2OP.exe -jar mylib.jar Exporting a single class from mylib.jar: Java2OP.exe -jar mylib.jar -classes com.mypackage.ClassName Exporting all the classes from a folder of Java sources specifying the file name of the output Delphi unit: Java2OP.exe -source myproject/src -unit Android.JNI.UnitName
我的命令:
java2op.exe -src A:\Tests -unit Android.JNI.TestFile
所以它符合指南:
Java2OP.exe -source myproject/src -unit Android.JNI.UnitName
如果我尝试将-src
更改为建议的-source
,则会收到以下错误:
无效选项:-source
执行命令后,发生1错误:
命令:javadoc -J-Xmx1024m -encoding“UTF-8”-sourcepath“A:\ java2op \ Java” -subpackages“” - classpath“” - bootclasspath“A:\ java2op \ bootclasses.jar”-docletpath“A:\ java2op \ doclava.jar” -doclet com.google.doclava.Doclava -nodocs -public -apixml“A:\ java2op \ temp.xml”
输出:javadoc:错误 - 包名称非法:“”1错误
我阅读了以下有关同一问题的帖子:
How can I extract a Delphi class from this JAVA file for use with Android?
但没有成功。
我错过了什么或做错了什么?