Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JShell <Shift+tab i> is not working properly in jdk 9

While trying JShell in Fedora I tried to used snippet transformation shortcut as specified here , but I think It is not working It is showing

Unexpected character after Shift-Tab. Use "i" for auto-import or "v" for variable creation. For more information see:

/help shortcuts

I tried the ways that specified in those messages but still same result

any Ideas or I am doing something wrong?

$javac -version

javac 9

java -version

openjdk version "9"

OpenJDK Runtime Environment (build 9+181)

OpenJDK 64-Bit Server VM (build 9+181, mixed mode)

Here is what I am trying to do :

jshell$ new JFrame

I typed new JFrame and then pressed shift+tab i(holding shift pressed and releasing tab and then pressing i). as per the docs it should show me something like:

0: Do nothing
1: import: javax.swing.JFrame
Choice:

but it is showing

Unexpected character after Shift-Tab. Use "i" for auto-import or "v" for variable creation. For more information see:

instead

like image 397
optional Avatar asked Oct 11 '17 13:10

optional


1 Answers

The way the shortcuts work is as follows :

Press Shift+Tab..Release both..Press 'i' or 'v'

--- Use Cases ---

  1. Type a constant for e.g.

    Enter '1' 
    Press Shift+Tab then Press 'v'
    Provide a variable name
    

    enter image description here

    Provide a variable name and you are done with.
    

    enter image description here

  2. Use a java internal class e.g. JFrame

    Enter 'new JFrame'
    

    enter image description here

    Provide your choice
    
like image 161
Naman Avatar answered Nov 18 '22 02:11

Naman