Could not find any executable java binary - java

please help with my problem that I'm facing since hours. I'm trying to run ElasticSearch-5.2.2 with MEAN Stack. I installed Java JDK 8 and I set the path correctly and also added this path "\Oracle\Java\javapath" still I'm getting the same error "Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME". Why it is happening can anyone help me out?

You said you "went to environment variables and added variable name: JAVA_HOME variable value: C:\Program Files\Java\jdk1.8.0_121\bin"
This is incorrect. Don't include the bin directory when you set JAVA_HOME.
Set JAVA_HOME to C:\Program Files\Java\jdk1.8.0_121
Once you are done with this, test it.
Open command prompt and type echo %java_home% and see if its printing the path you set.

Are you using Windows?
If so open your system environment variables and add a new one named JAVA_HOME and point it to your Java JDK
You can double check how to do this by referring to the thread here How to set java_home on Windows 7?
But what have you tried so far?

Related

Java: System cannot find the file C:\ ... java.exe

I have installed Java 8 and set my JAVA_HOME and JRE_HOME paths and added %JAVA_HOME% to the start of the path variable.
I created a helloworld.java application and am able to compile it using:
javac helloworld.java
However, when I try to run:
java helloworld
I get the error:
The system cannot find the file C:\ProgramData\Oracle\Java\javapath\java.exe
How can I solve this?
1.Just go to C:\ProgramData\Oracle\Java\javapath\
2.You will find there shortcuts for java.exe,javaw.exe,javaws.exe which are pointing to a location where they actually are not existing now
3.Go to the jre location where you have installed java like C:\Program Files\Java\jre6\bin
You will find java.exe,javaw.exe,javaws.exe
Create shortcuts for these files and replace with the ones which are present in C:\ProgramData\Oracle\Java\javapath.
It works
Just set %JAVA_HOME%/bin to your path variable.
If you are blocked from modifying system variables from command line, but are able to open up an elevated command prompt, then run a command like this:
setx \M JAVA_HOME "C:\Program Files\Java\jdk1.8.0_25"
But of course, change the directory to point to your installed version of java. Note that the JAVA_HOME path does not point into the bin directory, it stops one level above bin.
I was able to solve this issue. To do so I used the advice from this answer:
Java SE Development Kit 8u25 on a 64-bit Windows 8
Set the following user environment variables (== environment variables of type user variables)
•JAVA_HOME : C:\Program Files\Java\jdk1.8.0_25
•JDK_HOME : %JAVA_HOME%
•JRE_HOME : %JAVA_HOME%\jre
•CLASSPATH : .;%JAVA_HOME%\lib;%JAVA_HOME%\jre\lib
•PATH : your-unique-entries;%JAVA_HOME%\bin
(make sure that the longish your-unique-entries does not contain any other references to another Java installation folder.)

JAVA_HOME is not recognized as an internal/external command

I've tried just about everything but it will not recognize it.
I have the latest version of JDK installed, the path is located at "C:\Program Files\Java\jdk1.8.0_25". This is what I'm using for my "variable value" field when I add the new variable "JAVA_HOME"..
I also have a %JAVA_HOME%\bin; in my path variable. I've restarted multiple times, making small changes..
Help me :(
Keep in mind I don't have much of a clue of what I'm doing.. So I could be going about it completely wrong.. Running it in cmd
Change the path value %JAVA_HOME%\bin, instead of set this
C:\Program Files\Java\jdk1.8.0_25\bin
After setting that, open command prompt and check whether you have set JAVA_HOME correctly.
echo %JAVA_HOME%
java
echo %JAVA_HOME% will print the location where java installed and java will show the usage of java.
See here how to set JAVA_HOME

The JAVA_HOME environment variable is not set

I'm trying to make my first app using Phonegap and I got this while running in command
C:\USERS\KTR\DESKTOP\PHONEGAP\LIB\ANDROID\BIN>create C:\Users\KTR\Desktop\Demoap
p com.example.Demoapp Demoapp
The JAVA_HOME environment variable is not set.
Set JAVA_HOME to an existing JRE directory.
Remember to also add JAVA_HOME to the PATH variable.
After updating system variables, open a new command window and retry.
Any help would be greatly appreciated
Thank you
You have to do two things to get it fixed.
Firstly go to My Computer right click open properties and open Advanced System Setting and then open Environment variables. Open the Path variable and insert a semicolon at the end and add the path of your bin folder of your jdk it will be something like C:/Program Files/Java/ Jdk X.Y/bin save and close it.
Secondly create a new system variable named JAVA_HOME and in its value write C:/Program Files/ Java/ Jdk X.Y save and close and now retry by writing the create command
P.S find the version number go to your java folder and copy those version number hopefully this will help
You need Java on your computer. See how to install and configure java http://docs.oracle.com/cd/E19509-01/820-3208/inst_cli_jdk_javahome_t/
Hope this will help

"JAVA_HOME points to an invalid Java installation issue" with service install command in elastic search

I want to use elastic search with my PHP application.
after running service install command , I am getting fallowing error.
C:\elasticsearch-0.90.10\bin>service install
JAVA_HOME points to an invalid Java installation (no java.exe found in "C:\Progr
am Files (x86)\Java\jdk1.7.0_25\bin"). Existing...
Open up and Look into the service.bat file:
It searches for:
%JAVA_HOME%\bin\java.exe
hence your %JAVA_HOME% should not include bin in it.
A workaround if you do not have privileges to set up the environmental variables:
open the service.bat file,
a) Remove the line:
if NOT DEFINED JAVA_HOME goto err
b) Replace %JAVA_HOME% with your java jdk path, something like: C:\Program Files\Java\jdk1.7.0_51
Note: This is just a workaround which works all the time.
from your error message we can see your JAVA_HOME points to
C:\Program Files (x86)\Java\jdk1.7.0_25\bin
while it should point to
C:\Program Files (x86)\Java\jdk1.7.0_25
I think the error message is fairly descriptive , you should look in this folder
is java.exe there ? If not then your JAVA_HOME environment variable to point to the correct installation
heres a page showing how to do that
https://confluence.atlassian.com/display/DOC/Setting+the+JAVA_HOME+Variable+in+Windows
1st hit on google.
Either JAVA_HOME points to the wrong location or you don't have Java installed. Check and see if there's an install of Java in the location specified.
Also note that the JAVA_HOME variable should point to the root of the Java install not the /bin folder. This is being added by the program you're executing.
To change the JAVA_HOME variable to test further use the following in the command prompt:
set JAVA_HOME=c:\xxxx
Once you've established the correct value to use this can be permanently changed in Control Panel>>System>>Advanced System Settings>>Advanced>>Environment Variables
set JAVA_HOME=C:\Program Files (x86)\Java
Above must fix the issue, I came across the same issue while installing the elastic search.
i gave a try by giving "bin" part of path but it did not work, so i just give the top folder "java" in path, it worked.
Just to add my own experience.
i was setting JAVA_HOME using tab autocompletion.
It ends up something like "C:\Program files...:" and it didn't work saying that it cannot find the java program. I solved typing the JAVA_HOME path in the set command without using tab completion. The problem was probably related to the " in the env variable

Even when I defined the class path, javac is not recognizing it

I am using Windows 7 and 8 in my PC .
I have installed jdk 7 and created class path for bin as it should be. But when I enter javac in the command prompt, it throws an error:
`javac is not recognizing as internal and external`.
I have searched for a solution in many websites but nothing could solve my problem.
Would you please help me and suggest where my mistake could be?
You need to set the environmental variables. Run sysdm.cpl from run dialog box to open advanced system properties.
In the environmental variables, add a new one like in this dialog.
Name : JAVA_HOME
VALUE: C:\Program Files\Java\jdk1.7.0_21\
Now edit the value of the PATH variable and add ;%JAVA_HOME%\bin\; at the end of it's value.
Now, restart your system and you can run java related commands from command prompt.
also set path in your *System variables:path=c:/..../jdk/bin/;c:/..../JRE/bin;.;
user Variables:CLASSPATH=c:/..../jdk/bin/;c:/..../JRE/bin;.;
Double check your system variable "Path" on System Properties appending %PATH_TO_JDK%\bin. Don't forget to restart the command prompt after.
It is path not classpath - -till your bin folder
and restart cmd

Categories

Resources