Java is too limited when dealing with the Console
Remi Forax
forax at univ-mlv.fr
Tue Nov 15 21:35:27 UTC 2016
Hi Brunoais,
Java is not and will never be only what comes with the OpenJDK,
it's a big (really big) community full of libraries for whatever you wish and even sometimes what you don't wish.
So beside readline, you can also take a look at Jansi
https://github.com/fusesource/jansi
it's the package used by maven for its colored outputs.
Btw you can put a dll inside a jmod.
regards,
Rémi
----- Mail original -----
> De: "Roger Riggs" <Roger.Riggs at Oracle.com>
> À: core-libs-dev at openjdk.java.net
> Envoyé: Mardi 15 Novembre 2016 19:17:34
> Objet: Re: Java is too limited when dealing with the Console
> Hi Brunoais,
>
> Largely, because most people don't interact with java from a terminal
> and the simple stream
> oriented access has been sufficient. Take a look for layered libraries
> that can handle
> fancier terminals that have color and various positioning (ANSI) escape
> sequences
> that might meet your needs.
>
> Roger
>
>
> On 11/15/2016 1:09 PM, Brunoais wrote:
>> jLine requires a .dll on windows making it not OS agnostic. If this
>> existed in java itself, this problem would not be a problem because
>> java internal dll are signed by java and can be included without issues.
>>
>> But then, why doesn't java have this?
>>
>>
>> On 15/11/2016 15:12, Roger Riggs wrote:
>>> Hi,
>>>
>>> You might find an open source package like JLine would have the full
>>> featured terminal support you are looking for.
>>> http://jline.sourceforge.net/
>>>
>>> Roger
>>>
>>>
>>> On 11/13/2016 5:35 AM, Brunoais wrote:
>>>> Since java 6, a class named Console was created. This class allows
>>>> reading and writing directly to the console, including getting input
>>>> without echoing for password purposes.
>>>>
>>>> Unfortunately, that class does not include useful functionality for
>>>> java programs to work on the console and output formatted text. The
>>>> feature I miss the most is knowing how many columns I have to type
>>>> into in order to deliver an easier to read formatted output while
>>>> avoiding line wraps that are not coded in.
>>>>
>>>> There are other things I miss like having multi-line progress bars
>>>> (so far I can do single line if it is the last line by using "\r"
>>>> and re-writing the line).
>>>>
>>>> Other times, it is more user friendly to wait for any key press
>>>> instead of specifically waiting for "Enter" which will also add more
>>>> lines to the console.
>>>>
>>>> I did some search and found nothing about this. Why hasn't this been
>>>> implemented for java code?
>>>>
>>>
>>>
More information about the core-libs-dev
mailing list