0

I have stored all the jar file into specific folder and I have added specific folder to Jshell classpath. I am unable to import packages in jshell after adding classpath.

It is working fine If I have mentioned all the jar file name in classpath. I don't want to mentioned all the Jar file name in classpath because I have to add more than thousand number of jar files into classpath.

How to configure specific folder to Jshell classpath ?

enter image description here

poovaraj
  • 609
  • 1
  • 6
  • 10
  • 1
    Have you tried `*` [wildcard](https://stackoverflow.com/questions/1237093/how-to-use-a-wildcard-in-the-classpath-to-add-multiple-jars)? – Sal Jul 28 '18 at 14:24
  • You can either use `:` separated, complete list of `jar`s or the plugin mentioned in the answers of the duplicate question link. I can confirm both the ways just work fine. – Naman Jul 28 '18 at 15:26

1 Answers1

3

Declare the path of classpath in jshell.

jshell> /env -class-path path_of_dependecies

If classpath is current working folder

jshell> /env -class-path .

When you call specific class or call static method from dependencies, you must use command import

jshell> import com.foo_company.*

See authoritative tutorial http://cr.openjdk.java.net/~rfield/tutorial/JShellTutorial.html#setting-a-classpath

Vy Do
  • 46,709
  • 59
  • 215
  • 313