Thursday, August 4, 2016

Could not create the Java Virtual Machine

cat Test.java 
public class Test {
 public static void main(String[] args) {
        System.out.println("ciao");
 }

}
javac Test.java
export PIPPO="ciao - bello"
java -Dpippo=$PIPPO Test
Unrecognized option: -
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.



This is how a simple space in the value of a property can mess up your JVM.
if you run this
java -Dpippo="$PIPPO" Test
(with additional quotes) all works fine!

No comments: