我想将这些 Java 函数转换为 JavaScript:CircleFitter.java。我不需要文件读取部分。
JSweet似乎是一个不错的选择。因此,我尝试将 java 文件的内容粘贴到在线 JSweet 沙箱中,但出现以下错误:
Line 58: module 'java.io' has no exported member 'FileReader'
Line 58: property 'FileReader' does not exist on type 'typeof io'
Line 58: module 'java.text' has no exported member 'DecimalFormat'
Line 58: property 'DecimalFormat' does not exist on type 'typeof text'
Line 58: module 'java.text' has no exported member 'DecimalFormatSymbols'
Line 58: property 'DecimalFormatSymbols' does not exist on type 'typeof text'
Line 58: module 'java' has no exported member 'awt'
Line 58: property 'awt' does not exist on type 'typeof java'
Line 69: property 'in' does not exist on type 'typeof System'
Line 76: property 'exit' does not exist on type 'typeof System'
Line 125: property 'exit' does not exist on type 'typeof System'
Line 128: property 'exit' does not exist on type 'typeof System'
这些错误似乎分为两类:
- 模块 __ 没有导出的成员 __
- 类型 __ 上不存在属性 __
我不使用 Java,所以我不知道如何解决这些问题。我很感激帮助。