Reputation: 31888
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
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:-
Upvotes: 1