"Unrecognized option: --add-opens" Hyperledger Besu
Asked Answered
M

5

11

I want to get started with Hyperledger Besu, after following the steps of the official documentation here and running the following command:

bin\besu --help

I get the following error:

C:\Users\user\Desktop\besu-1.3.9>bin\besu --help
Unrecognized option: --add-opens
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

I get the same thing when running bin\besu or bin\besu -help.

I don't know if the problem is with java's installation or with hyperledger besu trying to run unvalid/unrecognised option bin\besu --add-opens. I tried uninstalling then reinstalling java but this did not solve the issue, here is java's version:

C:\Users\user>java -version
Picked up _JAVA_OPTIONS: -Xmx512m
java version "1.8.0_241"
Java(TM) SE Runtime Environment (build 1.8.0_241-b07)
Java HotSpot(TM) Client VM (build 25.241-b07, mixed mode)

Any help would be appreciated!

Milline answered 22/2, 2020 at 15:5 Comment(3)
--add-opens is part of project jigsaw, which was released with Java 9.Resurrection
I see, thank you for the info @Resurrection . Then why I'm getting Unrecognized option: --add-opens, what shoul I do?Milline
.. update to at least Java 9. Or - as the software's websiets states, Java 11.Resurrection
M
18

I have no prior experience with the library that is in discussion, but I have just had a look at the official docs of the library that you are trying to use, and the installation instructions state that you require Java 11+ to compile

Hyperledger Besu requires:

MacOS High Sierra 10.13 or later versions

Java 11+ to compile; earlier versions are not supported.

From your question, it looks like your system is running Java8. Try bumping it up to Java 11 and try starting the binary again.

Marinemarinelli answered 22/2, 2020 at 15:22 Comment(1)
Thanks for catching that, I installed Java 13.0.2 from here and didn't get the error again.Milline
N
3

change the java home version path from jdk8 path to jdk11 in environment variable as JAVA_HOME : {jdk11 directory path}

Notogaea answered 17/11, 2021 at 8:11 Comment(0)
O
1

The script you're running adds --add-opens java.base/sun.security.provider=ALL-UNNAMED to the java command line that starts Besu. As others have noted, the --add-opens parameter was made available in Java 9; all it does is prevent a warning from being issued when any class uses reflection to access an internal JDK class (in this case, the Sun security package). I've been starting Besu without this parameter for weeks with no problems, so you could have simply removed the parameter from the Besu start script or -- better -- upgraded to at least the Java 11 or higher version that Besu expects. According to Oracle, this command line parameter will be removed eventually, but that's a problem for the Besu maintainers, not you.

Odonto answered 26/3, 2020 at 3:23 Comment(1)
This parameter will not be removed, and those warnings have now turned into errors starting with Java 16. Java 17 did remove --illegal-access through.Barnardo
S
0

Simple Solution if one is using Tomcat to deploy their project. Go to the Run Configuration of Tomcat. Find this argument and remove the same. No need to change the Java path if you still want to use Java 8.

Sybilla answered 3/3, 2023 at 11:44 Comment(0)
D
-1

1)You can change the JAVA_HOME variable to at least Java 9 but official document says "Java 11+ to compile; earlier versions are not supported."

To set JAVA_HOME, do the following:
Right click My Computer and select Properties.
On the Advanced tab, select Environment Variables
Then edit JAVA_HOME to point to where the JDK software is located,
for example, C:\Program Files\Java\jre1.8.0_341

2)Or You can change the version of the JRE used by the local tomcat server from the Server runtime environment section.

Delois answered 2/6, 2023 at 9:36 Comment(1)
This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. To get notified when this question gets new answers, you can follow this question. Once you have enough reputation, you can also add a bounty to draw more attention to this question. - From ReviewPlaceman

© 2022 - 2024 — McMap. All rights reserved.