如何将 CodenameOne 源附加到我的项目?

Posted

技术标签:

【中文标题】如何将 CodenameOne 源附加到我的项目?【英文标题】:How to attach CodenameOne sources to my project? 【发布时间】:2017-06-27 17:13:55 【问题描述】:

我想深入研究 CN1 的问题。我用 git 关注了 this 和 this tutorial。但是,在 NetBeans 中,当我按住 ctrl 单击 CN1 对象时,它会显示“显示生成的源文件。没有源附加到类的 JAR 文件。”。如果我附上我刚刚下载的源代码,即“CodenameOne/CodenameOne/src”,源代码仍然找不到!

我尝试清理和构建项目,但出现错误:

Building jar: /home/pathTo/CodenameOneSRC/CodenameOne/CodenameOne/dist/CodenameOne.jar
CodenameOne.jar:
JavaSE.init:
JavaSE.deps-jar:
Created dir: /home/pathTo/CodenameOneSRC/CodenameOne/Ports/JavaSE/build
Updating property file: /home/pathTo/myProject/build/built-jar.properties
Created dir:     /home/pathTo/CodenameOneSRC/CodenameOne/Ports/JavaSE/build/classes
Created dir: /home/pathTo/CodenameOneSRC/CodenameOne/Ports/JavaSE/build/empty
Created dir: /home/pathTo/CodenameOneSRC/CodenameOne/Ports/JavaSE/build/generated-sources/ap-source-output
Compiling 21 source files to /home/pathTo/CodenameOneSRC/CodenameOne/Ports/JavaSE/build/classes
warning: [options] bootstrap class path not set in conjunction with -source 1.7
/home/pathTo/CodenameOneSRC/CodenameOne/Ports/JavaSE/src/com/codename1/impl/javase/JavaSEPort.java:115: error: package com.jhlabs.image does not exist
import com.jhlabs.image.GaussianFilter;
/home/pathTo/CodenameOneSRC/CodenameOne/Ports/JavaSE/src/com/codename1/impl/javase/JavaSEPort.java:8757: error: cannot find symbol
    GaussianFilter gf = new GaussianFilter(radius);
symbol:   class GaussianFilter
location: class JavaSEPort
    /home/pathTo/CodenameOneSRC/CodenameOne/Ports/JavaSE/src/com/codename1/impl/javase/JavaSEPort.java:8757: error: cannot find symbol
    GaussianFilter gf = new GaussianFilter(radius);
symbol:   class GaussianFilter    location: class JavaSEPort
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
3 errors
1 warning
/home/pathTo/myProject/nbproject/build-impl.xml:914: The following error occurred while executing this line:
/home/pathTo/myProject/nbproject/build-impl.xml:1445: The following error occurred while executing this line:
/home/pathTo/CodenameOneSRC/CodenameOne/Ports/JavaSE/nbproject/build-impl.xml:937: The following error occurred while executing this line:
/home/pathTo/CodenameOneSRC/CodenameOne/Ports/JavaSE/nbproject/build-impl.xml:269: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 14 seconds)

此外,由于找不到主类,项目无法再运行(尽管我在运行部分添加了 ports/JavaSE.jar)。

如何正确附加源并更改 CN1 源代码?

任何帮助表示赞赏,

问候

【问题讨论】:

【参考方案1】:

您需要 cn1-binaries 项目,并且需要确保 JavaSE 项目中的路径指向该项目中的有效位置。

例如GaussianFilter 在驻留在该项目中的 Filters.jar 中定义。

【讨论】:

以上是关于如何将 CodenameOne 源附加到我的项目?的主要内容,如果未能解决你的问题,请参考以下文章

如何在 Eclipse 项目中使用 Codenameone Source?

如何将 gradle 库依赖项添加到 codenameone 项目

如何将 html 附加到我的 QWebEngineView

如何快速将 json 附加到我的数组中

如何将 SOAP 标头附加到我的 C# 客户端?

如何将我的域名附加到我的服务器 IP 地址 (Apache)