I am trying to programmatically compile and run a java code snippet from inside an application of another language (C#). I have used the ikvm library to get java commands to run inside my C# code, and that part is working fine. Now I am trying to use this line that works in Java:
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
compiler.run(inputStream, output, error, args);
This compiles just fine in my C# code, but when I run it the compiler variable is null. I've read online that this can happen when you're running with a JRE instead of a JVM (because there is no compiler). I have my JAVA_HOME environment variable pointing to the JDK on my computer, and I was hoping it would use that, but apparently not.
My question is: is there a way to set the location of the JDK to use when creating a compiler?