Naman
Naman

Reputation: 31888

Is there a way to reset default imports of JShell?

Following the post Is there a way to remove imports in JShell?. I was wondering if there was a way to get rid of the default imports as well.

jshell> /imports
|    import java.io.*
|    import java.math.*
|    import java.net.*
|    import java.nio.file.*
|    import java.util.*
|    import java.util.concurrent.*
|    import java.util.function.*
|    import java.util.prefs.*
|    import java.util.regex.*
|    import java.util.stream.*

Upvotes: 2

Views: 380

Answers (1)

Naman
Naman

Reputation: 31888

The default imports from JShell are part of the startup scripts of the JShell. You can follow JShell documentation to find the option to avoid loading the startup scripts and can start jshell like this :

jshell --no-startup

The difference can be seen in the following screenshot:-

enter image description here

Upvotes: 1

Related Questions