This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
When you use /list, you properly see the valid snippets you’ve entered so far. But when you then use /1 /2 etc. to execute the snippets you’ve typed so far, it instead executes the default imports that are loaded when the session starts.
This is related to the bug that’s already filed about /# executing the wrong snippet. I was looking at JShell in NetBeans again this morning and noticed your prompt is [#] -> The first # displayed is 9, which I assume is because it’s treating JShell’s default imports and printf definition as 1-8. That is different from how JShell does it, where the first snippet you enter is #1. Another difference I noticed is that command-line JShell numbers only VALID snippets sequentially. So, for example, if you enter a valid snippet, followed by a snippet with an error, followed by another valid snippet, the two valid snippets are numbered 1 and 2 and the invalid one is e1. If you then execute /2, the second VALID snippet is recalled, not the one with the error that was typed second. In NetBeans, /# always recalls the snippet based on the number in the [#] -> prompt. I believe this work the same as in command-line JShell.
/n history command should now reexecute snippet "n" (as seen in /list command). Prompt numbers correspond to snippet numbers.