Hello
I am part of 2Sigma development team. My current project is “beakerx”.
In this project we can run code of some languages in browser.
Something like Your “kotlinc-jvm” interactive shell.
But in browser and with extra functionality.
It is based in Python Jupyter notebook. And we have different kernels for them : “groovy” , “Java” , “Scala” , “Cpp” …
Now I try to write “Kotlin” kernel. And I need to run kotlin code without installing languages (Having only “jar” files downloaded by gradle).
Basically I make them run, but I have some questions:
- I use K2JVMCompiler, is it best way ? (Us I understand “kotlinc-jvm” interactive shell uses it too.)
- I Have no “kotlinHome” , language is not installed locally. I have only jar files.
And not setting “kotlinHome”, I always get warings:
warning: classpath entry points to a non-existent location: <no_path>\lib\kotlin-runtime.jar
warning: classpath entry points to a non-existent location: <no_path>\lib\kotlin-script-runtime.jar
warning: classpath entry points to a non-existent location: <no_path>\lib\kotlin-reflect.jar
But this jar already in classpath, this “non-existent location” adds by “kotlinHome”
So, how can I get rid of this warning ?
arguments.suppressWarnings = true;
arguments.coroutinesState = K2JVMCompilerArguments.ERROR;
Do not help.
All code in there:
K2JVMCompilerArguments arguments = K2JVMCompilerArguments.createDefaultInstance();
//arguments.kotlinHome = pathToCore.toString(); // Nothing to set !!!
arguments.includeRuntime = true;
arguments.destination = outDir;
arguments.classpath = getEntriesAsString(classpathEntries, ";");
arguments.verbose = false;
arguments.suppressWarnings = true;
arguments.coroutinesState = K2JVMCompilerArguments.ERROR;
arguments.freeArgs = new ArrayList<>();
arguments.freeArgs.add(sourceFile.toString());
MessageCollector collector = new PrintingMessageCollector(errorPs, MessageRenderer.PLAIN_RELATIVE_PATHS, arguments.verbose);
exitCode = comp.exec(collector, Services.EMPTY, arguments);
if (ExitCode.COMPILATION_ERROR == exitCode) {
j.outputObject.error(new String(errorBaos.toByteArray(), StandardCharsets.UTF_8));
j.outputObject.executeCodeCallback();
} else if (ExitCode.OK == exitCode) {
....
}
Warnings Example:
More details about this problem can be found in this PR: