Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Starting Swing GUI without extra console window?

21 views
Skip to first unread message

Herman Jurjus

unread,
May 20, 2006, 3:04:40 AM5/20/06
to
Hello,

Perhaps this is a stupid question.
If you use the usual way to start a Swing GUI

public static void main(String[] args) {
invokeLater(new Runnable() {
public void run() { // etc.
}
});
}

then (at least in Windows), if you start this with a .bat file, you
still see an extra console window. If you close that window, then the
Swing GUI goes away, too. How can i start 'just the Swing GUI'?

--
Cheers,
Herman Jurjus

Andrey Kuznetsov

unread,
May 20, 2006, 3:15:21 AM5/20/06
to

use javaw insead of java.

Andrey

--
http://uio.imagero.com Unified I/O for Java
http://reader.imagero.com Java image reader
http://jgui.imagero.com Java GUI components and utilities


VisionSet

unread,
May 20, 2006, 1:07:27 PM5/20/06
to

"Andrey Kuznetsov" <sp...@imagero.com.invalid> wrote in message
news:e4mfm5$jjh$1...@online.de...

> > Hello,
> >
> > Perhaps this is a stupid question.
> > If you use the usual way to start a Swing GUI
> >
> > public static void main(String[] args) {
> > invokeLater(new Runnable() {
> > public void run() { // etc.
> > }
> > });
> > }
> >
> > then (at least in Windows), if you start this with a .bat file, you
still
> > see an extra console window. If you close that window, then the Swing
GUI
> > goes away, too. How can i start 'just the Swing GUI'?
>
> use javaw insead of java.
>

And use the dos START /B command in the bat file if necessary, you need to
on Win2000, as even with javaw the console window remains.

--
Mike W


jcsnippets.atspace.com

unread,
May 20, 2006, 8:03:42 PM5/20/06
to
"VisionSet" <sp...@ntlworld.com> wrote in message
news:j1Ibg.3452$Mm3....@newsfe6-win.ntli.net...
<snipped>

> And use the dos START /B command in the bat file if necessary, you need to
> on Win2000, as even with javaw the console window remains.

Isn't that only when you actually use "start javaw SomeClass" ?

I'd expect not to see a console window on Win2000, when you start an
application with "javaw SomeClass". That's the behaviour I'm used to on my
Win2000 machines.

Best regards,

JayCee
--
http://jcsnippets.atspace.com/
a collection of source code, tips and tricks


Jeffrey Schwab

unread,
May 21, 2006, 12:58:02 AM5/21/06
to
jcsnippets.atspace.com wrote:
> "VisionSet" <sp...@ntlworld.com> wrote in message
> news:j1Ibg.3452$Mm3....@newsfe6-win.ntli.net...
> <snipped>
>> And use the dos START /B command in the bat file if necessary, you need to
>> on Win2000, as even with javaw the console window remains.
>
> Isn't that only when you actually use "start javaw SomeClass" ?
>
> I'd expect not to see a console window on Win2000, when you start an
> application with "javaw SomeClass". That's the behaviour I'm used to on my
> Win2000 machines.

It's not javaw that opens/maintains the console window VisionSet
mentions, but the cmd.exe interpreter. If a shortcut, rather than a
batch file, is used to launch javaw TheClass, then as you suggest, the
console window won't show up at all.

Herman Jurjus

unread,
May 22, 2006, 5:13:37 AM5/22/06
to

Many thanks to all respondents!
start /b javaw TheClass
That did the trick. And using a shortcut works even nicer.

--
Cheers,
Herman Jurjus

Denis

unread,
May 22, 2006, 9:58:55 AM5/22/06
to

Herman Jurjus ha scritto:

Use webstart! Is an xml file with extension .jnlp. Then double click on
the file and the application starts. In the same way you can insert a
link to the jnlp file on an html page.

See
http://java.sun.com/docs/books/tutorial/information/javawebstart.html

DM

> --
> Cheers,
> Herman Jurjus

0 new messages