[
https://issues.apache.org/jira/browse/GROOVY-6453?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16666760#comment-16666760
]
Guy Rouillier edited comment on GROOVY-6453 at 10/29/18 5:42 AM:
-----------------------------------------------------------------
Found this via search. I'm on Windows 7 64-bit, and tried both
groovy-2.6.0-alpha-3 and groovy-3.0.0-alpha-3. Cursor keys are not working in
either one. I'm surprised to see this issue is now 5 years old. Is there some
basic restriction preventing this from being corrected in groovysh?
I tried creating a groovy.rc file containing the contents from the previous
post by Dariusz Antoniuk, but don't know where to put it. I tried in
\groovy-3.0.0-alpha-3\bin, \groovy-3.0.0-alpha-3\conf, and
C:\Users\<myusername>\.groovy, and it still didn't work.
[UPDATE]
Found this post that says the file to update is actually groovysh.rc.
https://stackoverflow.com/questions/52898321/groovysh-rc-file-breaks-groovysh-evaluate-switch
So I updated that in my home directory. Now I'm getting a NullPointerException:
D:\>groovysh
Picked up JAVA_TOOL_OPTIONS: -Duser.timezone=GMT
FATAL: java.lang.NullPointerException
java.lang.NullPointerException
at
java.util.concurrent.ConcurrentHashMap.replaceNode(ConcurrentHashMap.java:1106)
at
java.util.concurrent.ConcurrentHashMap.remove(ConcurrentHashMap.java:1097)
at
org.codehaus.groovy.runtime.memoize.UnlimitedConcurrentCache.remove(UnlimitedConcurrentCache.java:70)
at
groovy.lang.GroovyClassLoader.removeClassCacheEntry(GroovyClassLoader.java:640)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at
org.codehaus.groovy.runtime.callsite.PlainObjectMetaMethodSite.doInvoke(PlainObjectMetaMethodSite.jav
at
org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMethodSiteNoUnwrapNoCoerce.invoke(P
ethodSite.java:213)
at
org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:55)
at
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:128)
at
org.codehaus.groovy.tools.shell.Interpreter.evaluate(Interpreter.groovy:96)
at org.codehaus.groovy.tools.shell.Evaluator$evaluate.call(Unknown
Source)
at
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:128)
at
org.codehaus.groovy.tools.shell.Groovysh.evaluateWithStoredBoundVars(Groovysh.groovy:263)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at
org.codehaus.groovy.runtime.callsite.PlainObjectMetaMethodSite.doInvoke(PlainObjectMetaMethodSite.jav
at
org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(P
ethodSite.java:190)
at
org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:58)
at
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:51)
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:157)
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:177)
at org.codehaus.groovy.tools.shell.Groovysh.execute(Groovysh.groovy:204)
at org.codehaus.groovy.tools.shell.Shell.leftShift(Shell.groovy:122)
at org.codehaus.groovy.tools.shell.Shell$leftShift$0.call(Unknown
Source)
at
org.codehaus.groovy.tools.shell.commands.LoadCommand$_load_closure1.doCall(LoadCommand.groovy:86)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at
org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:104)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:326)
at
org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:264)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1043)
at groovy.lang.Closure.call(Closure.java:421)
at
org.codehaus.groovy.runtime.DefaultGroovyMethods.callClosureForLine(DefaultGroovyMethods.java:5913)
at
org.codehaus.groovy.runtime.IOGroovyMethods.eachLine(IOGroovyMethods.java:463)
at
org.codehaus.groovy.runtime.IOGroovyMethods.eachLine(IOGroovyMethods.java:416)
at
org.codehaus.groovy.runtime.ResourceGroovyMethods.eachLine(ResourceGroovyMethods.java:349)
at
org.codehaus.groovy.runtime.ResourceGroovyMethods.eachLine(ResourceGroovyMethods.java:333)
at org.codehaus.groovy.runtime.dgm$989.invoke(Unknown Source)
at
org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(Poj
hodSite.java:246)
at
org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:55)
at
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:128)
at
org.codehaus.groovy.tools.shell.commands.LoadCommand.load(LoadCommand.groovy:82)
at
org.codehaus.groovy.tools.shell.commands.LoadCommand$load.call(Unknown Source)
at
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:128)
at
org.codehaus.groovy.tools.shell.Groovysh.loadUserScript(Groovysh.groovy:400)
at org.codehaus.groovy.tools.shell.Groovysh.run(Groovysh.groovy:588)
at org.codehaus.groovy.tools.shell.Groovysh$run$0.callCurrent(Unknown
Source)
at
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:51)
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:157)
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:169)
at org.codehaus.groovy.tools.shell.Groovysh.run(Groovysh.groovy:577)
at org.codehaus.groovy.tools.shell.Groovysh$run.call(Unknown Source)
at
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:136)
at org.codehaus.groovy.tools.shell.Main.startGroovysh(Main.groovy:193)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at
org.codehaus.groovy.runtime.callsite.PlainObjectMetaMethodSite.doInvoke(PlainObjectMetaMethodSite.jav
at
org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(P
ethodSite.java:190)
at
org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:70)
at
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:136)
at org.codehaus.groovy.tools.shell.Main.main(Main.groovy:159)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at
org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:114)
at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:136)
was (Author: guyr):
Found this via search. I'm on Windows 7 64-bit, and tried both
groovy-2.6.0-alpha-3 and groovy-3.0.0-alpha-3. Cursor keys are not working in
either one. I'm surprised to see this issue is now 5 years old. Is there some
basic restriction preventing this from being corrected in groovysh?
I tried creating a groovy.rc file containing the contents from the previous
post by Dariusz Antoniuk, but don't know where to put it. I tried in
\groovy-3.0.0-alpha-3\bin, \groovy-3.0.0-alpha-3\conf, and
C:\Users\<myusername>\.groovy, and it still didn't work.
> groovysh in Windows 7/8/10 doesn't support arrow keys and Del
> -------------------------------------------------------------
>
> Key: GROOVY-6453
> URL: https://issues.apache.org/jira/browse/GROOVY-6453
> Project: Groovy
> Issue Type: Bug
> Components: Groovysh
> Affects Versions: 2.2.0
> Environment: Windows 8, 64bit (v6.2, build 9200), java version
> "1.7.0_45" SE Runtime Environment (build 1.7.0_45-b18) HotSpot 64-Bit Server
> VM (build 24.45-b08, mixed mode), Russian locale (!)
> Reporter: Andrew P Fink
> Priority: Major
> Labels: console, jline
>
> I have bare windows 8 with fresh JDK. I run Groovysh in cmd.exe.
> Groovysh 2.1.9 works as expected.
> Groovysh 2.2.0 doesn't react to arrow keys and Del, i.e. up key doesn't show
> previous command, left key doesn't shift cursor etc.
> After some investigation I found what is working:
> ctrl-a go to beginning of line
> ctrl-e go to End of line
> ctrl-f go Forward one char
> ctrl-b go Backward one char
> ctrl-d delete the char
> ctrl-h and backspace = delete left char
> ctrl-p recall previous line
> ctrl-n recall next line
> ctrl-s search
> ctrl-r reverse search
> It's nice and feel myself like a Linux hacker, but I want arrow keys too ;-)
> I tried different options:
> - upgrade jline2.10 to 2.11 - no effect
> - --terminal=unix - it helps, but duplicate prompt (groovy:000>) and no more
> colors in console
> Looks like problem lies in new jline v2 (groovysh 2.1.9 uses jline1.0)
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)