I executed below command: hadoop -version on hadoop version 1.2.1
vishrant#ubuntu:~$ hadoop -version
java version "1.7.0_79"
OpenJDK Runtime Environment (IcedTea 2.5.5) (7u79-2.5.5-0ubuntu0.12.04.1)
OpenJDK Server VM (build 24.79-b02, mixed mode)
I was expecting hadoop version but I got the version of JDK installed on my system. I know that correct command is hadoop version [without hyphen] but instead of getting error I got the version of JDK why?
It looks like the hadoop script for 1.2.x has much less checking than more recent versions, at this point (2016) its about 3 years old. You can see the source for it here.
In the 1.2.x script if you type hadoop -version the script will hit the final else statement where it works out what class to run and sets $CLASS to $COMMAND (line 338) instead of a class.
You can see what it will run on line 434:
exec "$JAVA" -Dproc_$COMMAND $JAVA_HEAP_MAX $HADOOP_OPTS -classpath "$CLASSPATH" $CLASS "$#"
So if you type hadoop version it will run (removed classpath stuff to keep it short):
java -Dproc_version -Xmx1000m -classpath <LIBS> org.apache.hadoop.util.VersionInfo
If you type hadoop -version you get:
java -Dproc_-version -Xmx1000m -classpath <LIBS> -version
So because the default behavior is to set $CLASS to $COMMAND you basically end up with it running:
java -version
Which is what you're getting.
Related
I am following the Getting Started Guide from the Quarkus site to try out Quarkus. But, when I execute this curl command
curl -Ls https://sh.jbang.dev | bash -s - app install --fresh --force quarkus#quarkusio
the following error is displayed.
[jbang] [ERROR] java.nio.charset.MalformedInputException: Input length = 1
Running quarkus install on Mac (Intel) running Monterey OS and here's my java info:
java --version
java 11.0.6 2020-01-14 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.6+8-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.6+8-LTS, mixed mode)
whereis java
java: /usr/bin/java
which java
/Library/Java/JavaVirtualMachines/jdk-11.0.6.jdk/Contents/Home/bin/java
Can somebody please let me know what I might be doing wrong?
Thanks
I used SDKMAN! to install Quarkus and that seemed to work.
I am setting up an Alluxio cluster. I ran the script ./bin/alluxio-start.sh all SudoMount, but got this error Error: Alluxio requires Java 8 or Java 11, currently Java 1.7.0_321 found. I already set JAVA_HOME and add it to $PATH to point to Java 8. Why does Alluxio still think it is java 7?
$$echo $JAVA_HOME
/usr/lib/jvm/java-1.8.0-openjdk-amd64
…$ java -version
openjdk version “1.8.0_322”
run this and see what’s the output: sudo update-alternatives --display java
if it’s linked to 1.7 then you can use following command to set it to 1.8 sudo update-alternatives --config java
ian new to centos 7
and iam configuring hadoop 2.7.1 cluster so i need to install openjdk as a requirement
so i installed one by the command
yum install java-1.7.0-openjdk
and java version command out put is
java version "1.7.0_131"
OpenJDK Runtime Environment (rhel-2.6.9.0.el7_3-x86_64 u131-b00)
OpenJDK 64-Bit Server VM (build 24.131-b00, mixed mode)
but my problem is that i want to use jps command and it is found in
java-1.7.0-openjdk-1.7.0.101-2.6.6.1.el7_2.x86_64
so i iwant to install this rpm and i used the command
cd /usr/lib/jvm
rpm -ivh --nodeps ftp://mirror.switch.ch/pool/4/mirror/scientificlinux/7.0/x86_64/updates/security/java-1.7.0-openjdk-1.7.0.101-2.6.6.1.el7_2.x86_64.rpm
but becuase a newer version of jdk is installed i wasn't able to install this rpm
with the error
package java-1.7.0-openjdk-1:1.7.0.131-2.6.9.0.el7_3.x86_64 (which is newer than java-1.7.0-openjdk-1:1.7.0.101-2.6.6.1.el7_2.x86_64) is already installed
i don't know if iam using the right way to make jps command works
what should i do to include jps command
and is it right to install an old release of openjdk i mean 101 when newer one already exists i mean 131
java-1.7.0-openjdk contains only the JRE. jps is part of the openjdk development package. Refer here.
Try
yum install java-1.7.0-openjdk-devel
Background first, I installed hadoop on ubuntu 14, but now I updated it to 16, and the java was updated too, from 1.7 to 1.8. But now my hadoop won't work and I'm trying install Hives. I updated my bashrc and source it, but hadoop still won't work.
This is my current java home:
dachen#dachen-VirtualBox:~$ echo $JAVA_HOME
/usr/lib/jvm/java-8-openjdk-amd64
dachen#dachen-VirtualBox:~$
But when I tried to open my usr/lib/jvm folder, there are two java, which one should I use for my java path for hadoop and hives? The java 1.8 or java-8? I mean to edit the bashrc for hadoop and hives?
dachen#dachen-VirtualBox:~$ cd /usr/lib/jvm
dachen#dachen-VirtualBox:/usr/lib/jvm$ ls
default-java java-1.8.0-openjdk-amd64 java-8-openjdk-amd64
dachen#dachen-VirtualBox:/usr/lib/jvm$
I also tried this command, I believe it is to find your default java path, it gave me this:
dachen#dachen-VirtualBox:~$ sudo update-alternatives --config java
[sudo] password for dachen:
There is only one alternative in link group java (providing /usr/bin/java): /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
Nothing to configure.
dachen#dachen-Virtual
problem: when deploying my war to tomcat7 i get the error
java.lang.UnsupportedClassVersionError: org.MyLibraryClass : Unsupported major.minor version 51.0
(this is the error one gets when compiling java with a newer version than the java used when running the code.)
situation, in order:
brand new ubuntu 12.04.1 server 64bit minimal, in a virtualbox
installed tomcat6
tried to deploy my war
realized the error, and that i need java7 because ubuntu 12 still comes with outdated java
installed oracle java 7 using this guide https://askubuntu.com/questions/197248/java-on-ubuntu-server-12-04
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
removed tomcat6 and installed tomcat7
sudo apt-get remove tomcat6-common
sudo apt-get install tomcat7
deployed my war to tomcat7
started tomcat
sudo service tomcat7 start
checked my app's log file. same error.
echo $JAVA_HOME is empty, java -version shows:
java version "1.7.0_07"
Java(TM) SE Runtime Environment (build 1.7.0_07-b10)
Java HotSpot(TM) 64-Bit Server VM (build 23.3-b01, mixed mode)
it's a default tomcat7 install, no modification. still i checked the startup scripts and config to make sure no custom java version is specified anywhere. also checked by asking catalina:
ubuntu#ubuntu:/home$ /usr/share/tomcat7/bin/catalina.sh version
Using CATALINA_BASE: /usr/share/tomcat7
Using CATALINA_HOME: /usr/share/tomcat7
Using CATALINA_TMPDIR: /usr/share/tomcat7/temp
Using JRE_HOME: /usr
Using CLASSPATH: /usr/share/tomcat7/bin/bootstrap.jar:/usr/share/tomcat7/bin/tomcat-juli.jar
Server version: Apache Tomcat/7.0.26
Server built: Jul 19 2012 03:21:30
Server number: 7.0.26.0
OS Name: Linux
OS Version: 3.2.0-29-generic
Architecture: amd64
JVM Version: 1.7.0_07-b10
JVM Vendor: Oracle Corporation
now i'm stuck. i don't see how any java code could fail to run on oracle's jre7.
my war is a brand new very basic hello world grails 2.1 app with maven, which has a maven dependency (org.MyLibraryClass) that is compiled with jdk7. that's the one for which i get the error.
in grails i changed BuildConfig.groovy to have 1.7 instead of 1.6:
grails.project.target.level = 1.7
grails.project.source.level = 1.7
then did a grails clean, rebuild, war, redeploy. no change.
any idea what to try next?
Typical error when compiling code with Java7 and running it under Java6.
The critical line in your query is this one I think:
sudo service tomcat7 start
I think it may be triggering the inheritance of OpenJDK still in the system there. What you want to do is instead try tomcat from your own environment.
Login as your normal user
java -version
/usr/share/tomcat7/bin/startup.sh
and check. You should also login as a clean user, root or elsewhere and check java -version to check.
If all else fails, go to /etc/profile and make sure path to Oracle's Java/bin directory is the very first thing in the PATH variable for the environment.
I have the same problem just now,but now it's solved.
Please check this symbolic
/usr/lib/jvm/default-java
it's default link is open-jdk, reset the correct jdk dirctory.
good luck!