When I try to connect API keys to a given app, the app crashes and I get the following error:
java.lang.reflect.InaccessibleObjectException: Unable to make field private static volatile java.net.Authenticator java.net.Authenticator.theAuthenticator accessible: module java.base does not "opens java.net" to unnamed module @6f1eab88
I now realize that I need to "build a specific binary (JAR) for my platform." I have been trying for a couple hours but truthfully have no idea what to do. Any help would be appreciated.
Specs:
MacOS Big Sur v11.6.8
Java v17.0.5
Gradle v7.6
Homebrew v3.6.16
GitHub link to project: https://github.com/quantverse/ptltrader
Instructions for building are in the "README.md" file.
I normally run the JAR file via terminal and it works fine until I try connecting to the website via API, at which point the app crashes. When I try to run any Gradle functions, nothing works because it's a JAR file.
I downloaded the .zip file and tried to run Gradle again but got several errors. I believe these are due to the code being written in 2012 and therefore being outdated. After replacing a couple lines of code as recommended by stackoverflow (such as "testImplementation" instead of "testCompile," and "doLast" instead of "<<"), I try running gradle ./gradlew run
as recommended by the source code, and get the following error:
Task './gradlew' not found in root project 'PTLTrader'.
When I try gradle run
, I get the following error:
> Process 'command '/usr/local/Cellar/openjdk@17/17.0.5/libexec/openjdk.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
At this point, I gave up because I did not know what else I could do. I tried moving the JAR file into the directory to run it with the rest of the zip file, but the same error/inability to connect to website API occurred.
CodePudding user response:
I cloned your repo and could succesfully build, like this:
In gradle-wrapper.properties
inside Project/gradle/wrapper
i changed the local distributionUrl of that project to:
distributionUrl=https\://services.gradle.org/distributions/gradle-5.0-bin.zip
(other versions like gradle-5.1.1-bin.zip should also work, but didn't test.
Ran a task once again with./gradlew build
and got this error:
Could not find method leftShift() for arguments [build_77lj9mcapfpzvdg4mdx64jy00$_run_closure7@5775175c] on task ':swtDiag' of type org.gradle.api.DefaultTask.
Went to Project/build.gradle and removed <<
on task swtDiag
which was deprecated on version 5.0:
It looks like this now:
task swtDiag {
println 'archSpec: ' archSpec
println 'swtWindowingLibrary: ' swtWindowingLibrary
println 'swtArch: ' swtArch
println 'swtPlatform: ' swtPlatform
}
BUILD SUCCESSFUL in 1m 21s
3 actionable tasks: 3 executed
P.S: make sure to use ./gradlew run. This is your project-specific gradle config instead of the system-wide. (both ./gradlew build
or ./gradlew run
worked fine.
References:
documentation about the error of my failed build
!!! As the github README.md documentation suggests, you need to use an older JDK version.