JShell static imports / local classes #1408
Unanswered
juhalindfors
asked this question in
Q&A
Replies: 2 comments 7 replies
-
I would try two things:
|
Beta Was this translation helpful? Give feedback.
0 replies
-
Running the same script with jshell works as expected:
Running with --verbose:
|
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is it possible to do static imports of locally compiled classes with jsh scripts running with JBang?
Related issue/question for stand-alone JShell can be found here: https://bugs.openjdk.org/browse/JDK-8213715
Following the above advice, compiling a class with package declaration in a local directory works with JShell:
Where the local directory bar/Bar.java implementation is simply defined as:
The corresponding class file is locally under the working directory bar/Bar.class which JShell appears to pick up into its classpath automatically.
However, trying to run a jsh script via JBang results in NoClassDefFoundError.
Have I missed something, or doing this wrong? Is this expected to work with JBang?
Beta Was this translation helpful? Give feedback.
All reactions