IntelliJ 2018.3 and JShell with custom classes
Answered
Hello. I'm trying to use JShell in IntelliJ IDEA Community 2018.3, but when I try to run the script, the console returns the following error:
ERROR: package org.somepackage does not exist
Rejected import org.somepackage.MyClass
My script looks like this:
import org.somepackage.MyClass;
MyClass m = new MyClass("Test");
System.out.println(m.getName());
I've tried a solution posted in StackOverflow, but with no luck: https://stackoverflow.com/questions/48143960/how-to-import-a-custom-class-in-intellij-jshell-console
Thanks in advance.
Please sign in to leave a comment.
Please share the complete project with the library configured that will reproduce the issue: https://intellij-support.jetbrains.com/hc/articles/206869619.
Sure. I've uploaded the file through HTTPS. The filename is "JShellTest.zip".
Again, thanks for the help.
Library root was set incorrectly, it should point to the default package (2 folders above):
Worked perfectly. Thank you very much.
For me its unusable so. I have a multimodule gradle project and i expect <whole project> puts all classes from all modules and all dependencies into account.
We have a related feature request, please follow https://youtrack.jetbrains.com/issue/IDEA-176418.
I have the same issue, I am attaching
the screen where is my Project Structure Library settings and it clearly points to the classes
of module sk.eea.jira.telecom.extension.model.ITs. Can Anybody look into it?
Try moving the library out of the target folder. For example, to the "/lib" directory in the project root.