How to get the current java home (path to your Java installation folder) in Java

1 Answer

0 votes
public class MyClass {
    public static void main(String args[]) {
        System.out.println("Java Home: " + System.getProperty("java.home"));
    }
}
 
 
 
 
/*
run:
 
Java Home: /usr/lib/jvm/java-11-openjdk
 
*/

 



answered Aug 6, 2021 by avibootz

Related questions

1 answer 128 views
1 answer 224 views
1 answer 213 views
...