【发布时间】:2020-01-04 14:05:16
【问题描述】:
我知道针对基本相同的错误发布了多个问题。但是,我认为它们与我的问题不同。
简而言之,我正在尝试编译 oci-java-sdk 附带的示例之一。它不编译。好像一个 jar 文件左右有 LOG 变量,所以我想知道在哪里可以找到 jar 文件。
这里是详细信息。首先,我使用的是 Oracle Linux,并使用 RPM 安装了 oci-java-sdk。之后,我将整个示例目录复制到我的主目录。这是我的 CLASSPATH 的样子:
$ echo $CLASSPATH
:/usr/lib64/java-oci-sdk/lib/oci-java-sdk-full-1.6.1.jar:/usr/lib64/java-oci-sdk/third-party/lib/*
由于工作需要,我尝试构建如下示例:
$ javac -Xlint -cp $CLASSPATH:$PWD/lombok.jar:/usr/share/java/*:/usr/share/java/slf4j/* ./EventsServiceExample.java
如上图,我从lombok项目网站下载了lombok.jar。 javac 命令失败如下:
$ javac -Xlint -cp $CLASSPATH:$PWD/lombok.jar:/usr/share/java/*:/usr/share/java/slf4j/* ./EventsServiceExample.java
./EventsServiceExample.java:83: error: cannot find symbol
LOG.info("Number of rules in compartment {} is {}", compartmentId, rulesList.size());
^
symbol: variable LOG
location: class EventsServiceExample
./EventsServiceExample.java:135: error: cannot find symbol
LOG.info(
^
symbol: variable LOG
location: class EventsServiceExample
./EventsServiceExample.java:143: error: cannot find symbol
LOG.error(
^
symbol: variable LOG
location: class EventsServiceExample
./EventsServiceExample.java:164: error: cannot find symbol
LOG.error("Failed to retrieve the Rule {}", ruleId, e);
^
symbol: variable LOG
location: class EventsServiceExample
./EventsServiceExample.java:188: error: cannot find symbol
LOG.info("Rule {} was updated", ruleId);
^
symbol: variable LOG
location: class EventsServiceExample
./EventsServiceExample.java:192: error: cannot find symbol
LOG.error("Failed to update rule {} with displayName {}", ruleId, newDisplayName, e);
^
symbol: variable LOG
location: class EventsServiceExample
./EventsServiceExample.java:217: error: cannot find symbol
LOG.error("Failed to list rules in compartment {}", compartmentId, e);
^
symbol: variable LOG
location: class EventsServiceExample
./EventsServiceExample.java:232: error: cannot find symbol
LOG.info("Rule {} was deleted", ruleId);
^
symbol: variable LOG
location: class EventsServiceExample
./EventsServiceExample.java:234: error: cannot find symbol
LOG.error("Failed to delete rule {}", ruleId, e);
^
symbol: variable LOG
location: class EventsServiceExample
9 errors
这让我觉得它找不到LOG,这一定是与slf4j相关的地方。我已经安装了所有类似 slf4j 的 RPM,但仍然没有运气。
以下链接是其他人抱怨相同错误消息的示例: intellij-14-lombok-slf4j-cannot-find-symbol-log
我发现更多类似的。大多数情况下,似乎每个 IDE 都有一些库,并且库和 lombok 应该与 IDE 一起配置好。
我不应该使用任何 IDE。我应该从命令行编译源代码。因此,我想我必须找到具有变量 LOG 的 jar 文件的上游在哪里。在那之后,希望我能找到一个有 jar 的 RPM(如果有的话)。
【问题讨论】:
标签: java slf4j lombok oracle-cloud-infrastructure