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!
I have no prior experience with the library which is in discussion, but I have just had a look at the official docs of the library which you are trying to use, and the installation instructions state that you require Java 11+ to complie
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. Trying bumping it up to java 11 and try starting the binary again.
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.
change the java home version path from jdk8 path to jdk11 in environment variable
as
JAVA_HOME : {jdk11 directory path}
Related
Posting again since someone moved my question a community where there is not much activity and the solution provided there in the comment did not work.
I have installed Amazon Corretto Java 17 from here.
However, I am not able to switch the Java version to Java 17.
Following are the steps I have already tried:
1.
export JAVA_HOME=$(`/usr/libexec/java_home -v17`)
export JAVA_HOME=/Library/Java/JavaVirtualMachines/amazon-corretto-17.jdk/Contents/Home
I have also check the highest version of Java using below command:
/usr/libexec/java_home and it shows correct Java 17 version:
/Library/Java/JavaVirtualMachines/amazon-corretto-17.jdk/Contents/Home
I have also checked all the versions of Java installed on my machine using command /usr/libexec/java_home -V and it correctly shows Java 8, 11, and 17:
17.0.1 (x86_64) "Amazon.com Inc." - "Amazon Corretto 17" /Library/Java/JavaVirtualMachines/amazon-corretto-17.jdk/Contents/Home
11.0.9.1 (x86_64) "Amazon.com Inc." - "Amazon Corretto 11" /Users/harsh.pamnani/Library/Java/JavaVirtualMachines/corretto-11.0.9.1/Contents/Home
1.8.0_275 (x86_64) "Amazon" - "Amazon Corretto 8" /Library/Java/JavaVirtualMachines/amazon-corretto-8.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/amazon-corretto-17.jdk/Contents/Home
I also added JAVA_HOME exports mentioned in step-1 and step-2 to .zshrc and .bash_profile as well.
I have followed multiple questions on StackOverflow and multiple
blogs as well. For example,
How to set or change the default Java (JDK) version on macOS?
switch java version on mac OS
https://java.tutorials24x7.com/blog/how-to-switch-java-version-on-mac
https://www.lotharschulz.info/2019/08/21/mac-change-default-java-version
https://akrabat.com/using-jenv-to-select-java-version-on-macos/
https://www.happycoders.eu/java/how-to-switch-multiple-java-versions-windows/
I am using jenv to switch between different java versions. Even jenv is not able to find Java 17. I used jenv versions and following is the output:
system
1.8
1.8.0.275
11
11.0
* 11.0.9.1 (set by /Users/harsh.pamnani/.jenv/version)
corretto64-1.8.0.275
corretto64-11.0.9.1
I have also checked that JAVA_HOME is pointing to Java 17. Here is the screenshot: Screenshot
Even after following all the steps above when I do java --version, it is still set to Java 11:
openjdk 11.0.9.1 2020-11-04 LTS
OpenJDK Runtime Environment Corretto-11.0.9.12.1 (build 11.0.9.1+12-LTS)
OpenJDK 64-Bit Server VM Corretto-11.0.9.12.1 (build 11.0.9.1+12-LTS, mixed mode)
I have also checked PATH variable, and nothing seems to be relatable to Java. Following is the output for path variables:
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
/Users/harsh.pamnani/Downloads/apache-maven-3.6.3/bin
Could someone please help me understand if I am missing anything here. Thank you.
which java is often used to find the exact executable you are calling when you type in java.
Keep in mind that when you type in the command java your JAVA_HOME setting is not used. Rather, the operating system PATH setting is used. If you have an older copy of java "before" the one you want to use on the path, then that's what the operating system will give you. To fix a problem like this, you need to alter your path such that the directory of your desired java version comes before any other java versions.
I do see that you checked your PATH setting, but I think you didn't know what to check, because you only listed directories. In those directories, a java executable exists. If the old executable comes in a directory earlier in the path, that's the version of java you will get when running it from the command line, regardless of any other settings.
Now, it is still important to have the JAVA_HOME set correctly, because when various Java tools want to discover items, thy might read JAVA_HOME (and if it is wrong, get directed to a non-matching JVM).
For some reason this issue is to do with with gradle and yarn, no matter what I do to try and get the 'fabric-loom' plugin working, nothing works. It says i am using an outdated version of Java, that i'm on Java 11 (I'm not, I did 'java -version' in the bash terminal), I'm on Mac btw, and it said I'm on Java 16.0.2, which is the version it tells me to be on, I'll attach logs and some code I wrote. If someone could help me, that would be great, thanks in advance :)
Crash Log:
Could not run phased build action using connection to Gradle distribution 'https://services.gradle.org/distributions/gradle-7.2-bin.zip'. Build file '/Users/joeplemople/Desktop/joes blocks/build.gradle' line: 2 An exception occurred applying plugin request [id: 'fabric-loom', version: '0.9-SNAPSHOT'] Failed to apply plugin 'fabric-loom'. You are using an outdated version of Java (11). Java 16 or higher is required.
(This was outputted twice for some reason, idk why)
Terminal Code (Bash):
Displaying what versions of java I have installed JoepleMoples-MacBook-Pro:
joes blocks joeplemople$ /usr/libexec/java_home -V Matching Java Virtual Machines (2): 16.0.2, x86_64: "Java SE 16.0.2" /Library/Java/JavaVirtualMachines/jdk-16.0.2.jdk/Contents/Home 11.0.12, x86_64: "Java SE 11.0.12" /Library/Java/JavaVirtualMachines/jdk-11.0.12.jdk/Contents/Home
Me setting the default version of Java to Java (JDK) 16:
/Library/Java/JavaVirtualMachines/jdk-16.0.2.jdk/Contents/Home JoepleMoples-MacBook-Pro:joes blocks joeplemople$ export JAVA_HOME=$(/usr/libexec/java_home -v 16.0.2) JoepleMoples-MacBook-Pro:joes blocks joeplemople$ java -version java version "16.0.2" 2021-07-20 Java(TM) SE Runtime Environment (build 16.0.2+7-67) Java HotSpot(TM) 64-Bit Server VM (build 16.0.2+7-67, mixed mode, sharing)
Thanks in advance
:)
Open Command Palette and choose Java: Configure Java Runtime, select jdk16 for both Project JDKs and Java Tooling Runtime.
Then reload window to make change effective and see if the error goes away.
Recently I downloaded Java SE 8 as Java SE 14 was causing me some issues on my mac. I had downloaded it and tried to change the coding in terminal to change my version of java from 14 to 8 by following along to a website, and when I had completed I double-checked to see if the coding had worked by typing
java -version and it stated I was still on 14. So I attempted redoing the whole coding process over again but when I typed /usr/libexec/java_home -v instead of telling me what java options are available, instead it states "java_home: option requires an argument -- v"
pls anyone help.
You're getting that message because you have to indicate a Java version number when you use the -v flag.
On MacOS, to find all versions of Java installed on your machine, type:
/usr/libexec/java_home -V
Note capitalization. This argument will show you the path of all JVMs installed on your Mac.
For the lowercase flag, you can see the install path of specific versions of Java. For example:
/usr/libexec/java_home -v 1.8
will show you all versions of Java 1.8 installed. You got the error message because you were indeed missing an argument: the Java version number.
I want to upgrade my jdk on a centos server, after some simple searches i found some solutions.
from this link you can see that the instructions are simple:
jdk 7 installation guide for centos
-install your jdk from rpm package or from source
-do some alternatives
-check the practical version (java -version)
and i go easy with the first two steps but in check version step i get this error:
Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/Object
i have also checked alternatives --config java and simbolic links.
i have also tried which command to find out what java is actually running and this was the link directoins.
/usr/bin/java -> /etc/alternatives/java -> /usr/java/jdk-1.8.0_40/bin/java
the weird point is when i run /usr/bin/java -version it is OK and it returns the version but when i run java without any prefix i got that error.
so what is the problem?
you may need to setup CLASSPATH variable so that jvm could load needed libraries.
see this post https://docs.oracle.com/javase/tutorial/essential/environment/paths.html
I am currently having huge issues installing HermesJMS (1.14 or 1.15) on OSX 10.9.2
Downloading the dmg file from their site fails with an error saying the .app file is damaged
So I download the jar file, with the installation being successful.
I downloaded the jar files from here: 1.14 1.15
I then switch to the terminal and run the hermes.sh in the bin directory and I get the following error
~$ ./hermes.sh
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.jidesoft.swing.SplashScreen.create(Unknown Source)
at hermes.browser.HermesBrowser.main(HermesBrowser.java:224)
Caused by: java.lang.ClassCastException: java.util.HashMap cannot be cast to java.awt.RenderingHints
at com.jidesoft.swing.JideSwingUtilities.<clinit>(Unknown Source)
... 2 more
Here are my java versions:
~$ java -version
java version "1.7.0_55"
Java(TM) SE Runtime Environment (build 1.7.0_55-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.55-b03, mixed mode)
Does anyone have a clue as to why this is so?
I am basically wanting to use it to view a ActiveMQ topic
Any help would be much appreciated
Thanks
The problem has to do with Java not enabling web plug-in and Web Start features. I ran into this problem with Java versions 7 & 8 (jdk1.7.0_21.jdk, jdk1.8.0.jdk).
Java 6 is required.
Getting Java 6
Download and install Java for Mac OS X (1.6.0_65-b14-462): http://support.apple.com/kb/DL1572
Then follow these instructions to re-enable the Apple-provided Java SE 6 web plug-in and Web Start features: http://support.apple.com/en-us/HT202643
fyi - Installation locations
These are typical install locations for Java for OSX:
Apple-installed Java for Mac OS X install location: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Oracle Java install location: /Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home
Running HermesJMS with Java 6
To use Java 6 for the life of your terminal window:
~$ export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
then run
~$ ./hermes.sh
If your goal is to "monitor" a JMS Topic within ActiveMQ, you can use JMSToolBox on sourceforge
You only need a JRE 8 on the path
The first answer did work for me.
The JAVA_HOME variable issue could be fixed by using jenv utility.
download Java 1.6 as mentioned above;
install jenv;
add Java 1.6 to the list of versions managed by jenv:
jenv add /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/
Add the following lines to hgermesjms.sh file, # Setup the Java VM section:
jenv local 1.6
export JAVA_HOME="$HOME/.jenv/versions/jenv version-name"
jenv version-name should be quoted by backticks (`), Markdown stole them.
That is how it worked for me.
The fix is displayed in more details in this answer.