Programdata oracle java javapath java exe

Cannot find java.exe

I am trying to launch a .bat file but I get the error System cannot find the file C:\ProgramData\Oracle\Java\javapath\java.exe I understand that this is probably a path variable, but I have not been able to understand how to fix it, if that is the problem. Thanks in advance.

Have you fixed your Java path by going into environment variable area? Also, what is your jdk directory location and what can you see in the bin folder inside your jdk? Do you have any java exe present at all?

3 Answers 3

First of all, the path that you provided i.e. C:\ProgramData\Oracle\Java\javapath\java.exe doesn’t appear to be correct. It should point to either JRE or JDK folder that you (probably) have in here:

C:\Program Files (x86)\Java\jdk1.8.0_25\bin 

In there you should at least see the following files (and hence, the addition of this bin directory to your PATH variable in the env vars):

If you don’t see the files above, something is definitely wrong! Also, even if you were using JRE (not JDK), you should still have this bin folder present, where java.exe resides.

I had the same problem. Here’s what worked for me: Go into your path variable and delete: C:\ProgramData\Oracle\Java\javapath\ .
Then add a new one called: %JAVA_HOME\bin
This post helped: java-path-is-not-pointing-to-sdk-path-in-windows

Edit: Sorry, I just noticed that this question was 3 years old.

. @ECHO OFF :: Export java settings from registry to a temporary file START /W REGEDIT /E %Temp%\java.reg "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft" if not exist "%Temp%\java.reg" ( START /W REGEDIT /E %Temp%\java.reg "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\JavaSoft" ) if not exist "%Temp%\java.reg" ( echo java not installed exit /b 1 ) :: Find java location FOR /F "tokens=1* delims==" %%A IN ('TYPE %Temp%\java.reg ^| FIND "INSTALLDIR"') DO SET "JAVA_HOME=%%B" SET "JAVA_HOME=%JAVA_HOME:"=%" SET "JAVA_HOME=%JAVA_HOME:\\=\%" ::SET JAVA_HOME set "java=%java_home%\bin\java.exe" "%java%" -version . 

Try this to see if you can automatically can detect the java location.And if it’s work you can put this at the beginning of your script and use %java% in your script (though it will decrease the performance).

Linked

Hot Network Questions

Subscribe to RSS

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

Site design / logo © 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA . rev 2023.7.27.43548

Читайте также:  Public abstract int java

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.

Источник

Inspired by Actual Events

My observations and thoughts concerning software development (general development, Java, JavaFX, Groovy, Flex, . ).

Select posts from this blog are syndicated on DZone and Java Code Geeks and were formerly syndicated on JavaWorld.

Dustin’s Pages

Thursday, July 2, 2015

Oracle Java on Windows: C:\ProgramData\Oracle\Java\javapath

I recently downloaded an early access release of JDK 9 (build 68) for my Windows 7-based laptop. Because this is an early release, I was not surprised when the automatic installation introduced some less than ideal issues with the main Java Runtime Environment (JRE) installation on my laptop. After playing with the JDK 9 features that I wanted to try out, I downloaded the latest Oracle JDK 8 (Update 45) and used the automatic installer to install that. While still in that session, everything worked well.

When I powered up the laptop and logged in the next morning, my Java runtime environment was not healthy. The problem traced to specification of C:\ProgramData\Oracle\Java\javapath\java.exe as the first entry in my Path environment variable. When I changed directories to see the contents of the C:\ProgramData\Oracle\Java\javapath directory, I saw the following:

This screen snapshot indicates that the java.exe , javaw.exe , and javaws.exe entries in the C:\ProgramData\Oracle\Java\javapath\ directory are actually symbolic links ( ) to similarly named executables in the JRE 9 installation.

The next screen snapshot shows the effect of this on my Java runtime environment:

The message is very clear on what the issue is: «The system cannot find the file C:\ProgramData\Oracle\Java\javapath\java.exe.» The reason that the system is looking for that is because the C:\ProgramData\Oracle\Java\javapath\ directory is the first entry in the Path and the symbolic links in that directory point to a JRE 9 directory that doesn’t exist (I only have the JDK 9 directory):

StackOverflow user shpeley provides a nice overview of this situation and how he/she solved it. As I did, shpeley found that the automatic installer did not update these symbolic links when moving back versions (in shpeley’s case, from JDK 8 to JDK 7). Borrowing from shpeley’s solution (convenient because the syntax for making symbolic links in DOS is provided), I ran the following commands in the C:\ProgramData\Oracle\Java\javapath\ directory:

mklink java.exe "C:\Program Files\Java\jdk1.8.0_45\bin\java.exe" mklink javaw.exe "C:\Program Files\Java\jdk1.8.0_45\bin\javaw.exe" mklink javaws.exe "C:\Program Files\Java\jdk1.8.0_45\bin\javaws.exe"

The Oracle JDK/JRE installation on Windows normally goes very smoothly and, at most, I typically only need to change my %JAVA_HOME% environment variable to point to the new directory (when upgrading the JDK). However, when things occassionally don’t go as smoothly, it’s helpful to be aware of the directory C:\ProgramData\Oracle\Java\javapath\ and its symbolic links. In (fortunately rare) cases, it may even be necessary to change these symbolic links.

Читайте также:  Html form отключить автозаполнение

UPDATE: Ganesh’s comment reminded me that it may be necessary to run Command Prompt (or Powershell) as Administrator to perform the operations discussed in this post. Two screen snapshots that follow demonstrate doing this in Windows 10. The first image shows right-clicking on «Command Prompt» and selecting «Run as administrator» and the second image shows what a Command Prompt window opened in that fashion looks like (in this case, it says «Administrator: Command Prompt» in the window’s title bar rather than the normal «Command Prompt».

Источник

«The system cannot find the file C:\ProgramData\Oracle\Java\javapath\java.exe»

I am on JDK 8u25 on Windows 8, and I am experiencing a problem with my Java installation. I can run javac perfectly fine, but running java produces this error message:

The system cannot find the file C:\ProgramData\Oracle\Java\javapath\java.exe 
  • JAVA_HOME – C:\Program Files\Java\jdk1.8.0_25
  • CLASSPATH – .;%JAVA_HOME%\lib
  • PATH – ;%JAVA_HOME%\bin

And their expansions, as viewed with set in cmd, are:

  • JAVA_HOME – C:\Program Files\Java\jdk1.8.0_25
  • CLASSPATH – .;C:\Program Files\Java\jdk1.8.0_25\lib;%CLASSPATH%;
  • PATH – C:\ProgramData\Oracle\Java\javapath;C:\Program Files\Java\jdk1.6.0_45\bin;;C:\Program Files\Java\jdk1.8.0_25\bin

The full output of set can be viewed here.

@johny What I did is similar to the post on the link. Do I not need a \lib at the end of classpath? I tried it with and without. I still got the error message when I tried to run the class file.

Your screenshot has a strange character instead of a \ . Why? I cant identify the character. It’s probably not a good idea to reveal your environment variables. You should only show the relevant ones

21 Answers 21

I’ve got a similar problem I’m currently working on solving. I can’t say this will solve your error since there may be issues with other software (which is my case with Eclipse Luna).

Java is using the path given in your PATH variable, which is,

 C:\ProgramData\Oracle\Java\javapath 

Go to this folder (ProgramData is hidden, so unhide it if necessary) and right click on the java.exe symlink. You’ll see in the Target field where it’s looking for java.exe. It may be pointing to the java.exe file from your previous jdk1.6.0_45 install. Either paste in new shortcuts here or change the PATH setting as others have mentioned.

Читайте также:  Setting Font Size

I’ve found that the Java installer doesn’t change the javapath or update the system path, at least when going from 1.8 to 1.7. In my case changing the shortcuts only led to a problem with Eclipse on startup.

EDIT:—— After playing with javapath folder shortcuts it turns out you need symlinks, at least for Eclipse. See, Windows how to create directory symlink.

You don’t need the /d switch for a file symlink,

 mklink java.exe "C:\Program Files\Java\jdk1.8.0_20\bin\java.exe" mklink javaw.exe "C:\Program Files\Java\jdk1.8.0_20\bin\javaw.exe" mklink javaws.exe "C:\Program Files\Java\jdk1.8.0_20\bin\javaws.exe" 

Источник

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:

The system cannot find the file C:\ProgramData\Oracle\Java\javapath\java.exe 

in system variables section check the path variable that is there C:\ProgramData\Oracle\Java\javapath path in it

4 Answers 4

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

  1. You will find java.exe,javaw.exe,javaws.exe
  2. Create shortcuts for these files and replace with the ones which are present in C:\ProgramData\Oracle\Java\javapath.

Just set %JAVA_HOME%/bin to your path variable.

Obviously you work with Windows. Be sure to exit and restart your console after configuring the path in your system properties. — Do you like to give us your path (set path)?

Thank you I have solved the issue now. I had set the JDK_HOME and JRE_HOME vars to the wrong path. I have included an answer stating the paths that I used.

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.)

Источник

Оцените статью