Hadoop: JAVA JPS tool not working - java

I have the Hadoop installed everything looks working fine, except jps.
every time run jps,(I have Oracle Java jdk1.8.0_31 installed) I get this:
The program 'jps' can be found in the following packages:
* openjdk-7-jdk
* openjdk-6-jdk
Try: sudo apt-get install <selected package>
anyone can help? really appreaciate.
here is my java version:
java -version
java version "1.8.0_31"
Java(TM) SE Runtime Environment (build 1.8.0_31-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode)

Write "which java", you'll get the path to your java, and in the bin directory look for "jps".
If you find jps there then, perform the below step:
ln - s /usr/bin/jps
OR
You can add bin directory to the class path

Related

How to downgrade Java on El Capitan

How do you downgrade Java version on MacOSX El Capitan? Right now when I run java -version I get:
java version "9.0.1" Java(TM) SE Runtime Environment (build 9.0.1+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)
I need to have it say:
java version "1.8.0_25" Java(TM) SE Runtime Environment (build 9.0.1+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)
So I can run a specific npm java based package.
I tried following instructions on Java website for uninstall/re-install with no luck. They suggest to run these 3 commands:
sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
sudo rm -fr /Library/PreferencePanes/JavaControlPanel.prefPane
sudo rm -fr ~/Library/Application\ Support/Java
Doing this seems to do nothing. When I run java -version I still get the same result.
I watched this video But I cannot find the JavaAppletPlugin.plugin referenced in video.
What am I doing wrong? How do you change Java version on El Capitan Mac OS?
Look at SDKMAN - http://sdkman.io/
You install it, then do sdk list java
sdk list java
================================================================================
Available Java Versions
================================================================================
9.0.1-zulu
9.0.1-oracle
9.0.0-zulu
8u152-zulu
8u151-oracle
8u144-zulu
> + 8u141-oracle
8u131-zulu
7u141-zulu
6u65-apple
You can install any or all of these, and select whichever one you want to use and set a default, as well:
See the docs here:
http://sdkman.io/usage.html

installation error for elasticsearch on windows7

I have been trying to setup elasticsearch in windows7 machine by following https://www.elastic.co/guide/en/elasticsearch/reference/current/_installation.html
I was able to download, unzip but when running ./elasticsearch, I get the below error,
Error: Could not find or load main class
org.elasticsearch.tools.JavaVersionChecker
Elasticsearch requires at least Java 8 but your Java version from C:\Program
Files\Java\jdk1.8.0_131/bin/java does not meet this requirement
I have verified Java versions installed and they look fine,
$ java -version
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
$ javac -version
javac 1.8.0_131
Can someone point out where I am wrong ?
In run Elasticsearch in Windows, you should run with elasticsearch.bat not ./elasticsearch directly:
And now we are ready to start our node and single cluster (Windows users should run the elasticsearch.bat file):
Seems like you don't have right permissions. Try to set them to 774 and check again:
sudo chmod 774 -R elasticsearch-6.3.2/

JDK Version inconsistent

My os is Ubuntu 16.04 LTS.
$ cat /etc/profile # part content of this file
JAVA_HOME=/usr/local/java/jdk1.8.0_101
JRE_HOME=$JAVA_HOME/jre
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
export JAVA_HOME
export JRE_HOME
export PATH
$ echo $JAVA_HOME
/usr/local/java/jdk1.8.0_101
$ java -version
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)
$ ls /usr/local/java/
jdk1.7.0_79/ jdk1.8.0_101/
Why is my java version still jdk7?
Ubuntu has ability to work with multiple java versions. In your case, it just means that it has both JDK 7 and JDK 8 installed in your system but is using JDK 7.
To switch from one java version to another, you can use sudo update-alternatives --config java. This will list all JDKs installed in your system, just enter the number corresponding to JDK 8 and it should switch to JDK 8.
Run which java in your command shell. That will tell you where the java command you are running is coming from.
I suspect that is will tell you "/usr/bin/java" ... because this:
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
puts your new bin directories onto the end of the search path, not the beginning.
However, the better way to do this would be to use alternatives as suggested by another Answer. (With a custom installation in "/usr/local" this will require some fiddling around to get "alternatives" to understand the alternative.)

Why is Git Bash not using the correct Java path as defined in the PATH environment variable?

In an instance of Git Bash, typing in java -version gives me:
Error: could not open 'C:\Program Files (x86)\Java\jre7\lib\i386\jvm.cfg'
However, my actual Java path is in D:\Program Files\Java\jdk1.8.0_45\bin. This is shown in my %PATH% variable if I type in either echo $PATH or env | grep PATH.
Where is Git Bash getting this nonexistent Java path from?
P.S.
To add on to this, running java -version in the Command Prompt gives me the correct output:
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
Check if you have some old java.exe, javaw.exe, javaws.exe in the c:/windows/system32 folder, as mentioned in "Java path..Error of jvm.cfg".
I just checked with Git 2.6.3 on Windows, where I don't have anything in c:/windows/system32, and the result is consistent between:
git bash:
vonc#bigvonc MINGW64 /
$ java -version
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)
and CMD:
C:\prgs\git\PortableGit-2.6.3-64-bit>java -version
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)
Both report the same java at the same spot:
vonc#bigvonc MINGW64 /
$ which java
/c/prgs/jdk/jdk-7u51-windows-x64/bin/java
C:\prgs\git\PortableGit-2.6.3-64-bit>which java.exe
C:\prgs\jdk\jdk-7u51-windows-x64\bin\java.exe
Conclusion: upgrade to the latest git for windows.
If you are trying to manually set JDK, then please check if you haven't missed the Oracle Java (C:\ProgramData\Oracle\Java\javapath) in Path Environment Variable under System Variables, remove it and java -version should work just fine.
Check the PATH variable in your .bash_profile file to make sure it reflects the correct version of java. The file is usually in your home directory C:\Users\\{HOME}\\.bash_profile
It will happen when you have running an IDE with another set of JDK instances. The better way to resolve this is set you JDK home in path and make it available in last row. This is working for me.

GWAN not recognising Sun Java 7

OS:
Ubuntu 12.04 Desktop
Java installed:
java version "1.7.0_05"
Java(TM) SE Runtime Environment (build 1.7.0_05-b05)
Java HotSpot(TM) 64-Bit Server VM (build 23.1-b03, mixed mode)
Running sudo ./gwan gives following error:-
Please install OpenJDK or SUN Java
.
'report.java': to use Java (*.java) scripts, install 'javac' (sudo apt-get install javac).
'loan.java': to use Java (*.java) scripts, install 'javac' (sudo apt-get install javac).
'argv.java': to use Java (*.java) scripts, install 'javac' (sudo apt-get install javac)..
'hello.mm': to use Objective-C++ (*.mm) scripts, install 'gobjc++' (sudo apt-get install gobjc++)
'all.java': to use Java (*.java) scripts, install 'javac' (sudo apt-get install javac)
Javac, Java both in sys path, both available in terminal
I have not touched any configuration files just went through
http://gwan.com/download
then
tried heading over to
localhost:8080/?hello.java
note: all C files work.
Have not tried openJDK though I would like to stay away from this option.
Try to use the JAVA_HOME environment variable to tell which JVM should be used. The G-WAN site has a dedicated Java FAQs entry for that question.
Reporting the same kind of problems in the past I have been told that the next release will be more JVM-agnostic.

Categories