Closed px1099 closed 6 years ago
Did you check whether JAVA_HOME is set? Instructions: https://www.thewindowsclub.com/set-java_home-in-windows-10
I already set it to D:\Java\jdk-9.0.4
If the tests in the previous article pass then idk. A friend was facing issues just because Jdk wasn't in Program Files for some reason (weird I know). Maybe look into that?
Try java --version
and javac --version
and see if they are correct
java --version
Error: could not find java.dll
Error: could not find Java SE Runtime Environment
javac --version
javac 9.0.4
That would mean that the jdk is set up properly, but the jre(used to running java applications) is not
A side question: given JRE is a subset of JDK, shouldn't the JDK be able to run the .jar file?
Given that gradlew and intelliJ are still working perfectly fine, this is very unusual
So this is the full context: A few day ago, I opened java control panel and accidentally uninstalled jre 9 and jre 10 I reinstalled jre 9 and 10 and set up the Path, and I managed to continue developing the project as usual But now these errors appear when I try to open the jar file
Can I ask how to fix this?
Not too strange. IntelliJ initializes with its own project variables, which are correctly set for you.
Make sure your system variables:
To check if java is set correctly, running where java
after setting up the paths saif mentioned should return your JDKPath\bin\java.exe
After trying some solutions for a while, I decided that this is too problematic and "Hard reset": uninstall everything, and then only install jdk-9.0.4 After installing, I set up the environment variables based on the guide in this website: https://stackoverflow.com/questions/1672281/environment-variables-for-java-installation It is working fine now.
When I try to open a Jar file, these errors pop up:
Error: could not find java.dll
Error: could not find Java SE Runtime Environment