In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "What to do if you can't use readLine normally in Gradle/IDEA". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let Xiaobian take you to learn "What to do if readLine cannot be used normally in Gradle/IDEA"!
problem
In console programs built by Gradle, the standard input readLine always returns null
reason
Gradle's standard inputs are not bound to system standard inputs by default and need to be set manually
solution
Add to build.gradle.kts
tasks.named("run") { standardInput = System.` in`}
If you need cleaner output, you can use
gradle console:run -q --console=plain
Solution (Groovy)
Add to build.gradle
run { standardInput = System.in}
Supplement: Handling issues where jline does not work properly in the IDEA development environment
Phenomenon: When developing an application in IDEA and using jline to capture console input, it cannot run normally, mainly reflected in the following code that cannot be executed after entering carriage return:
ConsoleReader reader = new ConsoleReader();
reader.readLine("> ");
Solutions:
Before using jline, execute the following code:
jline.TerminalFactory.registerFlavor(TerminalFactory.Flavor.WINDOWS, jline.UnsupportedTerminal.class);
You can also add parameters to the program startup command line
-Djline.terminal=jline.UnsupportedTerminal
At this point, I believe that everyone has a deeper understanding of "how to use readLine normally in Gradle/IDEA", so let's actually operate it! Here is the website, more related content can enter the relevant channels for inquiry, pay attention to us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.