Java电报机器人发生了非法的反射访问操作

问题描述 投票:2回答:1

我一直在使用这个library尝试使用Java运行Telegram bot。我使用Gradle设置项目以使用依赖项。

我的项目层次结构如下:

.gradle
build
gradle
src
 -main
  -java
   -Main.java
   -MyAmazingBot.java
build.gradle
gradlew
gradlew.bat

这是我用来设置Gradle的guide。我使用Gradle Wrapper让我的构建运行。

但是,我收到以下警告:

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/C:/Users/addis/.gradle/caches/modules-2/files-2.1/com.google.inject/guice/4.1.0/eeb69005da379a10071aa4948c48d89250febb07/guice-4.1.0.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

然而机器人运行良好(它回复我的消息)。

1)此消息是否应引起关注?

2)是否可以使用java -jar运行jar文件?我收到一条消息no main manifest attribute, in .\build\libs\fsc2.jar

3)是否可以在不使用Gradle包装的情况下运行./gradlew run

java gradle telegram
1个回答
2
投票

1)这显然是由于Gradle和Java 9之间不兼容。问题已在Gradle 2.4.12中修复。

参考:

2)显然,没有。但是,通过一些努力,应该可以生成一个JAR文件,其中包含可以以这种方式运行的应用程序及其依赖项。

3)可能是的。这些包装器只是脚本,因此您应该能够通过在shell命令提示符下键入命令来执行相同的操作。 (我建议你阅读脚本来了解它在做什么,然后决定是否直接运行应用程序。)

© www.soinside.com 2019 - 2024. All rights reserved.