...

Signature
Andrew Thompson
http://www.physci.org/
>>> How can you expect help when you are rude about answering questions
>>> yourself?
[quoted text clipped - 8 lines]
> discussion as the original question. OTOH, should
> you choose the 'help-desk' in future, don't forget..
Well, normally I do add a "I'm trying to achieve foo", but this really
was a straight forward question and I was trying to spare the
reader/helper from excess un-needed information. To the point and
concise so as to not waste time.
Now that we got this far I may as well say why :). A small app that I'm
writing is to run on a server. It can either be a double-clicked jar, or
it can be invoked from the command-line. Providing the argument "-noui"
on the command-line forces user interaction via the prompt. In graphical
mode there is a single dialog with fields and buttons.
Since many servers may not run a graphical server I wanted to make sure
that in such cases I handle the problem correctly. In such cases the
user obviously won't be double clicking the jar file, so a quick check
of isHeadless() will allow me to force the command-line user-interaction
as though the argument "-noui" was provided.
>> ..Perhaps I should have added one of these: :)
>
> .lots of these: $
lol, I'll give you 0% of those and 200% of these :):).
Piet Blok - 11 Dec 2007 13:41 GMT
> Now that we got this far I may as well say why :). A small app that
> I'm writing is to run on a server. It can either be a double-clicked
> jar, or it can be invoked from the command-line. Providing the
> argument "-noui" on the command-line forces user interaction via the
> prompt. In graphical mode there is a single dialog with fields and
> buttons. :):).
Well, if that is the case, you may try System.console(). As far as I have
tested, it returns a non null object only when started from the console
(with java.exe) and null for other invocations.
(Sorry if this was mentioned previously, but I can't reread the history of
this thread)
Piet.
voorth - 11 Dec 2007 14:50 GMT
> Well, if that is the case, you may try System.console(). As far as I have
> tested, it returns a non null object only when started from the console
> (with java.exe) and null for other invocations.
Since this is a new Java 6 feature, this might not be available to
everyone.
Henk
RedGrittyBrick - 11 Dec 2007 14:49 GMT
>> Perhaps not to a help-desk (though they might be able to provide a
>> better answer, cheaper, knowing the ultimate goal - as opposed to the
[quoted text clipped - 8 lines]
> reader/helper from excess un-needed information. To the point and
> concise so as to not waste time.
One reason for stating your goal is that people like me are often
interested in solutions to such goals. I'd probably not be able to
benefit so much from the proferred solutions if the goal is hidden. For
me it is a question of recognising a similar situation when faced with
it and recalling prior discussion here (or being able to find it using a
Google Groups search).
Which I suppose is just repeating that most of us treat this as a
discussion group for the benefit of all, rather than a help desk for
only the benefit of the OPs individually.
Lionel van den Berg - 12 Dec 2007 08:49 GMT
> Which I suppose is just repeating that most of us treat this as a
> discussion group for the benefit of all, rather than a help desk for
> only the benefit of the OPs individually.
I assure you, I do occasionally make a point of reading through
unanswered messages to try to help others. But very often there is
someone else with a better answer so I restrict my answers to cases in
which I know very well.
Lew - 12 Dec 2007 15:26 GMT
>> Which I suppose is just repeating that most of us treat this as a
>> discussion group for the benefit of all, rather than a help desk for
[quoted text clipped - 4 lines]
> someone else with a better answer so I restrict my answers to cases in
> which I know very well.
RGB's point was about answering questions about *your* problem, not helping
others with theirs.

Signature
Lew
Andrew Thompson - 11 Dec 2007 14:49 GMT
...
(snip tech. answer to 'problem spec.')
Thanks for the technical clarification. I suspected it
was something along those lines, but it is interesting
to have that confirmed.
>>> ..Perhaps I should have added one of these: :)
>>
>> .lots of these: $
>
>lol, I'll give you 0% of those and 200% of these :):).
.. I think we've reached understanding. ;-)

Signature
Andrew Thompson
http://www.physci.org/
Martin Gregorie - 11 Dec 2007 18:54 GMT
> Now that we got this far I may as well say why :). A small app that I'm
> writing is to run on a server. It can either be a double-clicked jar, or
> it can be invoked from the command-line. Providing the argument "-noui"
> on the command-line forces user interaction via the prompt. In graphical
> mode there is a single dialog with fields and buttons.
You may be able to spiff it up a bit past the simple Q&A prompt
dialogue. Take a look at the Jcurses package. Its on Sourceforge. I
haven't used it, but I did look at its documentation. It seems to be
designed to let a Java application present a curses-type screen
interface when a graphical interface, e.g. Xterm, isn't available.
I didn't do more than read its docs and save a reference to it because
it wouldn't do what I needed, which was to bang a cursor round in a 24 x
80 JPanel so I could emulate a terminal as part of a Swing graphical
display.
I don't have guaranteed a solution to autodetecting a graphical
environment, but would reading the terminal type using
System.getenv("TERM") tell you anything useful?

Signature
martin@ | Martin Gregorie
gregorie. | Essex, UK
org |