Menu

#290 jansi with wrapper

open
nobody
None
5
2012-12-11
2010-10-08
Anonymous
No

I have console application that uses jansi (http://jansi.fusesource.org/) library for colored output. but when I wrap my application and run it using your wrapper I get only black and white output. Is there some way to use both jansi and your wrapper ?

Discussion

  • Christian Mueller

    hi,

    Thanks for your report.
    I took a look at this and could understand your issue.

    The basic reason, why jansi on windows doesn't seem to work is because jansi requires a System.console() to be set. However when running the jvm with the wrapper, the jvm doesn't have an own console handle, i.e. it's set to null.

    I will dig around this issue a bit more and give you an update as soon as I find out more.

    Cheers,
    Christian

     
  • klaas hermanns

    klaas hermanns - 2010-10-18

    Did you find out more? This is interesting for us as well :-)

     
  • Christian Mueller

    hi,

    I'm afraid to say that it is rather a problem working around to get java.io.Console for the jvm for the wrapped jvm. Also because java.io.Console is final and only has an private default constructor we can't wrap it like System.in/out/err. So all in all, I don't think you will be able to use jansi with the wrapper on windows. linux/unix is fine though as long as you don't try to instrument java.io.Console with System.out ( AnsiConsole.systemInstall() )...

     
  • Leif Mortenson

    Leif Mortenson - 2010-10-19

    Any users interested in this, please post to this message. We are also interested in any ideas for how people would like to see this work.

    The problem now is that the Wrapper process launches with its own console. But the Java process is created in a way that it does not have a console handle. This is done so that the Wrapper has the ability to capture any and all stdout/stderr output form the JVM. There are several features which would stop working if this were not done this way.

    Cheers,
    Leif

     
  • Arkadiusz Balwierz

    is there possibility to inject our class into loading (or logging) rutine of wrapper in a way that there we will have original console handler and we can then setup it using jansi lib?

    Best regards,
    Arek

     

Log in to post a comment.