Crash java.lang.IllegalStateException: must set env JAVA_HOME
neo-expert opened this issue · comments
On my Linux machine JAVA_HOME is not set, the JVM crashes with following error:
$ java -jar jvm-core/target/mini-jvm.jar -jar jvm-core/target/mini-jvm.jar -jar test.jar
Exception in thread "main" java.lang.IllegalStateException: must set env JAVA_HOME
at com.gxk.jvm.util.Utils.classpath(Utils.java:263) at com.gxk.jvm.VirtualMachine.run(VirtualMachine.java:58) at com.gxk.jvm.Main.main(Main.java:28)
yes , it depends on a classpath, the oracle jdk8 classpath on my macos machine .
i want hack standard lib as little as possible , so my mini-jdk just hack 3 class .
in other words, mini-jvm must depends on another classpath .
Can you implement a fallback for the case if JAVA_HOME is not set? Maybe set the classpath to current directory?
Because on my machine it is not set even though Java is installed.
Yes, it's good for the user, but I'm not going to do it.
There are a lot of corner case to deal with, I choose to fail-fast, not keep running.
Thanks for the advice.