I want to set the JAVA_HOME variable from a batch script
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
While not perfect, you can use the following to discover the current JRE folder:
If it's the JDK you want, use:
For a more robust solution based on checking the Windows Registry, use:
For the JDK, you'll need this line instead:
This doesn't search the entire hard drive. It only searches the parent directory tree and so its much faster than using "dir java.exe /B /S".
This snippet will search the current PATH for java.exe, and print out where it was found:
On my system this gives me
Using this you can set JAVA_HOME as follows: