Programdata oracle java path

[java] «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 

I think the problem has to do with my environment variables.

The important variables, as I have set them, are:

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

The answer is

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.

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" 

Why Oracle did such a poor way to point to java is beyond me. We solved this problem by creating a new link to the JDK

mklink /d C:\ProgramData\Oracle\Java\javapath "C:\Program Files\Java\jdk1.8.0_40\bin\" 

The same would work for a JRE if that is all that is required.

This replaces the old symlinks in C:\ProgramData\Oracle\Java\javapath (if they existed previously)

C:\ProgramData\Oracle\Java\javapath;C:\Program Files\Java\jdk1.8.0_92\bin;
C:\ProgramData\Oracle\Java\javapath; 

and that fixed the issue for me. java -version now gives details about the Java version, etc.

This will solve all problems relating to Java and environment variables:

  1. Make your way to Windows’ Environment Variables dialog.
  2. Under System variables, select the variable named Path. Click Edit.
  3. Remove the entry that looks like:
C:\ProgramData\Oracle\Java\javapath 

Updating the PATH Environment Variable

If you do not set the PATH variable, you need to specify the full path to the executable file every time you run it, such as:

C:\> "C:\Program Files\Java\jdk1.8.0\bin\javac" MyClass.java 

It is useful to set the PATH variable permanently so it will persist after rebooting.
To set the PATH variable permanently, add the full path of the jdk1.8.0\bin directory to the PATH variable. Typically, this full path looks something like
C:\Program Files\Java\jdk1.8.0\bin .
Set the PATH variable as follows on Microsoft Windows:

  • Click Start, then Control Panel, then System.
  • Click Advanced, then Environment Variables.
  • Add the location of the bin folder of the JDK installation to the PATH variable in System Variables.
    The following is a typical value for the PATH variable: C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files\Java\jdk1.8.0\bin

The new path takes effect in each new command window you open after setting the PATH variable.

There are 2 versions of jdk in your PATH VARIABLE jdk1.6.0_45 and jdk1.8.0_25 . Try removing the first one ie. jdk1.6.0_45 from the PATH

This usually happens when you update the java, the easiest way to solve this is to just uninstall the JDK & then reinstall it. NOTE: This doesnt remove the path or classpath so no need to worry.

This problem exists when you upgrade from one version to another.because jdk is not automatically upgraded.

For the same you can change the environmental varibles. In system variables look for the PATH and add the jdk bin location in the front of the string(not at the back). Once you have done that check in CMD if «java» and «javac» works. if it works, again go to system variables. add «CLASSPATH» A the variable and set value » . c:\Program Files\Java\jdk1.8.0_91\lib;«

If you’re on a corporate PC that’s fairly restricted by group policy, this might work.

  1. your Windows PATH includes C:\ProgramData\Oracle\Java\javapath
  2. you have JDK installed to C:\Program Files\Java\jdk1.8.0_60\bin

Then create the following text file mklink.bat and put it on your desktop:

rem mklink.bat mklink /d C:\ProgramData\Oracle\Java\javapath "C:\Program Files\Java\jdk1.8.0_60\bin" pause 

Now right-click it and choose «Run as Administrator». Provide admin credentials. The script should report success. Now you can compile or run Java.

I got same error while running JAVA command. To resolve this, I moved the java path as the first entry in the path, and it resolved the issue. Please have look at this screenshot for reference:

enter image description here

  1. Uninstall all JDKs installed on your computer from the Java Control Panel
  2. Search for C:\ProgramData\Oracle\Java and delete that directory and all files contained within. You can do this from the command line using rmdir /S C:\ProgramData\Oracle\Java
  3. Then search for C:\ProgramData\Oracle and delete the oracle folder. You can do this using rmdir /S C:\ProgramData\Oracle
  4. Now install JDK and set the path.
  5. Run the program.You won’t find the same problem anymore.

I had also similar problem where by I had to un-install JDK 1.8 and needed jdk 1.7. What i did was removed the symbolic links from the javapath and then imported the shortcuts of java, javaw, javaws from the bin directory to the javapath folder. However, I found some permission issues in the enterprise laptop where by I did not have the privilege to modify/ update this directory. I had given appropriate permission from the administrator and there by resolved it.

Please remove «C:\ProgramData\Oracle\Java\javapath\java.exe» from the Path variable and add your jdk bin path. It will work.

In my case the I have removed the the above path and added my JDK path which is «C:\Program Files\Java\jdk1.8.0_221\bin»

<>\Common Files\Oracle\Java\javapath\ is now created as a junction, no symlinks anymore

c:\ProgramData\Java\javapath is used for symlinks. You can of course add the full path to your Java Path to %PATH% , but equally you can create a symlink to the path to the above location.

mklink java.exe «C:\Program Files\Java\jdk1.8.0_25\bin\java.exe»

There must be two or more PATH variables. Try merging all of them into one using semi-colon (;)

I got the same after installing java8 from a non-permissioned account. To fix I simply reinstalled from admin user account. This created the quoted directory with file links to java exes.

For New version of Java JavaPath folder is located

«C:\Program Files \Common Files\Oracle\Java\javapath\»

«C:\Program Files(x86) \Common Files\Oracle\Java\javapath\»

Don’t worry. Just uninstall jdk as well as jdk updates Before re installing jdk ,delete the oracle folder inside programData hidden folder in C:\ Then reinstall. Set the following,

JAVA_HOME CLASSPATH PATH JRE_HOME ( is optional) 

Источник

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.

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

Источник

Читайте также:  Convert object to hashmap java
Оцените статью