4

I recently installed Java (Java Runtime 1.8.121) to my machine. I need to set up JAVA_HOME and set the variable from the Java folder where it installed.

Everywhere I have looked online says the Java folder should be located in Program files (x86), however, it is nowhere to be found. Its not in program files (x86), not in program files. I wasn't able to choose a destination when it was installed as Software center was used. It simply completed the installation.

Can someone please help me find where the Java folder is so I can set up JAVA_HOME???!

xerx593
  • 12,237
  • 5
  • 33
  • 64
golf umbrella
  • 233
  • 2
  • 4
  • 16
  • 2
    Can you execute `java --version` on the command line? If so, try `where java`. – Andy Turner Nov 16 '21 at 14:20
  • If he want to set up JAVA_HOME i guess java XXX command will not be available, am i wrong? – Wortig Nov 16 '21 at 14:21
  • @Wortig possibly. But PATH and JAVA_HOME are separate environment variables, so maybe PATH is set. – Andy Turner Nov 16 '21 at 14:23
  • https://www.baeldung.com/java-check-is-installed "as with java -version, this command is only useful if our PATH environment variable points to the bin directory." – eglease Nov 16 '21 at 14:23
  • `java -version` will work without `JAVA_HOME` – eglease Nov 16 '21 at 14:24
  • This might help: https://www.baeldung.com/java-home-on-windows-7-8-10-mac-os-x-linux – eglease Nov 16 '21 at 14:25
  • 1
    Does this answer your question? https://superuser.com/questions/1148677/finding-location-java-home-in-windows-10 – eglease Nov 16 '21 at 14:25
  • What distribution of Java did you install? AdoptOpenJDK/Temurin (old adoptopenjdk)/ORACLE JDK... ? Maybe post a site from which you downloaded Java. Installations of different JDK's / JRE's can have different paths. – Wortig Nov 16 '21 at 14:26
  • I think the superuser question might have answered it. I checked Java control panel, which shows that it's actually in C: > ProgramData > App-V > 758738 > 3232234 > Root > VFS > ProgramFilesX86 for some reason. – golf umbrella Nov 16 '21 at 14:36
  • Strangely enough CMD did not work - entering "where java" brought back "INFO: could not find files for the given pattern". – golf umbrella Nov 16 '21 at 14:37
  • Because its in program data, which is hidden, I can't use it to set up JAVA_HOME. Does anyone know if I can just move the Java folder elsewhere? Straight into my C: Program files x86? Without it messing anything else up? – golf umbrella Nov 16 '21 at 14:45
  • Please, use your APP-V client! ...then you (probably) can: `java -version`, `where java`, ... – xerx593 Nov 16 '21 at 15:21

2 Answers2

5
xerx593
  • 12,237
  • 5
  • 33
  • 64
  • java_home is java_home, but this "solution" considers `%PATH%` only !;) – xerx593 Nov 16 '21 at 14:33
  • when I do "where java" in cmd I just get "INFO: could not find files for the given patterns" – golf umbrella Nov 16 '21 at 14:39
  • it means: it is not on/your installer didn't (successfully) modify the `%PATH%` ... App-V: doesn't that mean that you are/use java in a "virtual environment"!? ;) https://social.technet.microsoft.com/Forums/en-US/5398078e-0956-461c-b9d6-28be15ff0965/appv-50-environment-variable?forum=mdopappv – xerx593 Nov 16 '21 at 14:44
5

Open a command prompt

type: wmic product where "Name like '%%Java%%'" get installlocation,Name

This command can take a minute to complete. But should return something like this.

enter image description here

Edit: The benefit of this command, is that it doesn't rely on any system environment variables. It searches for installed programs that have the word 'Java' in the name. It won't return extra files or locations.

JonR85
  • 700
  • 4
  • 12