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

System.out.println in applet

522 views
Skip to first unread message

Yuandan

unread,
Aug 12, 2000, 3:00:00 AM8/12/00
to
I try to print out a string using System.out.println("Hello World!") in
applet. The compilation is ok, but when viewing the applet using a
netscape browser, it does not show any string. The browser is java
enabled.

Can someone help me if System.out.println does not work in applet or
toher reasons?

Thanks,

Yuandan

Arnaud Denagbe

unread,
Aug 12, 2000, 3:00:00 AM8/12/00
to
The System.out.println prints text to the standard output, this means
genreally to the terminal from which you started your application.
But with an applet you don't have any terminal, so you can't see anything.
Instead of using System.out, print your text on your applet's frame.

--
*************************************************************************
Arnaud DENAGBE
arnaud....@free.fr
arnaud...@onetelnet.fr
arnaud....@mail.dotcom.fr
http://arnaud.denagbe.free.fr
Pas de Bill... Linux est la!!!
*************************************************************************
Yuandan <ydz...@iastate.edu> a écrit dans le message :
3995824E...@iastate.edu...

Arnaud Denagbe

unread,
Aug 12, 2000, 3:00:00 AM8/12/00
to
System.out.println uses the standard output to print texts, generally
the standard output is the shell from which you started your application.
But in case of applets you don't have any shell so you can't see anything.
Instead of using the System.out, print your text on your applet's frame.

Daniel Morin

unread,
Aug 12, 2000, 3:00:00 AM8/12/00
to

Yuandan wrote:

> I try to print out a string using System.out.println("Hello World!") in
> applet. The compilation is ok, but when viewing the applet using a
> netscape browser, it does not show any string. The browser is java
> enabled.
>
> Can someone help me if System.out.println does not work in applet or
> toher reasons?
>
> Thanks,
>
> Yuandan

Using System.out.println in an applet will print to the console, which is
not the main screen of the browser. If you want to see the console, you
have to instruct the browser to show you the java console. You do this in
Netscape by going to communicator/tools/java console

Daniel


Bezdomny

unread,
Aug 12, 2000, 3:00:00 AM8/12/00
to
I think what you want is:

public void paint(Graphics screen)
{
screen.drawString("Hello World");
}

Bezdomny

"Yuandan" <ydz...@iastate.edu> wrote in message
news:3995824E...@iastate.edu...

Henri Benoit

unread,
Aug 14, 2000, 3:00:00 AM8/14/00
to Arnaud Denagbe
You can see the output with the appletviewer or in the java console.

Arnaud Denagbe schrieb:

> System.out.println uses the standard output to print texts, generally
> the standard output is the shell from which you started your application.
> But in case of applets you don't have any shell so you can't see anything.
> Instead of using the System.out, print your text on your applet's frame.
>
> --
> *************************************************************************
> Arnaud DENAGBE
> arnaud....@free.fr
> arnaud...@onetelnet.fr
> arnaud....@mail.dotcom.fr
> http://arnaud.denagbe.free.fr
> Pas de Bill... Linux est la!!!
> *************************************************************************
> Yuandan <ydz...@iastate.edu> a écrit dans le message :

> 3995824E...@iastate.edu...
> > I try to print out a string using System.out.println("Hello World!") in
> > applet. The compilation is ok, but when viewing the applet using a
> > netscape browser, it does not show any string. The browser is java
> > enabled.
> >
> > Can someone help me if System.out.println does not work in applet or
> > toher reasons?
> >
> > Thanks,
> >
> > Yuandan
> >
> >
> >

--
la lettre seule tue, mais l' ESPRIT des lettres vivifie

henri.benoit.vcf

Hans Kamp

unread,
Aug 14, 2000, 3:00:00 AM8/14/00
to

"Yuandan" <ydz...@iastate.edu> schreef in bericht
news:3995824E...@iastate.edu...

> I try to print out a string using System.out.println("Hello World!") in
> applet. The compilation is ok, but when viewing the applet using a
> netscape browser, it does not show any string. The browser is java
> enabled.

I think there is no text based output window available. There is only such a
window of you execute your applet by using appletviewer. The output is sent
to the window from which you launched appletviewer.

You write "It does not show any string". Where do you expect or want to
appear the output which you otherwise would send to an output window?

> Can someone help me if System.out.println does not work in applet or
> toher reasons?

System.out.println does work in an applet, and I often use that command for
testing my applets because I am not very familiar with jdb and the -debug
flag of appletviewer.


--

Hans Kamp (Win2000)
in...@hanskamp.com
www.hanskamp.com


Jon Skeet

unread,
Aug 14, 2000, 3:00:00 AM8/14/00
to
hmk...@home.nl wrote:
>
> "Yuandan" <ydz...@iastate.edu> schreef in bericht
> news:3995824E...@iastate.edu...
> > I try to print out a string using System.out.println("Hello World!") in
> > applet. The compilation is ok, but when viewing the applet using a
> > netscape browser, it does not show any string. The browser is java
> > enabled.
>
> I think there is no text based output window available. There is only such a
> window of you execute your applet by using appletviewer.

On the contrary - most browsers with applet integration have a console
window. Certainly IE and Netscape do.

--
Jon Skeet - sk...@pobox.com
http://www.pobox.com/~skeet/

Henri Benoit

unread,
Aug 14, 2000, 3:00:00 AM8/14/00
to Hans Kamp
It is written in the java console.

Hans Kamp schrieb:

> "Yuandan" <ydz...@iastate.edu> schreef in bericht
> news:3995824E...@iastate.edu...
> > I try to print out a string using System.out.println("Hello World!") in
> > applet. The compilation is ok, but when viewing the applet using a
> > netscape browser, it does not show any string. The browser is java
> > enabled.
>
> I think there is no text based output window available. There is only such a

> window of you execute your applet by using appletviewer. The output is sent
> to the window from which you launched appletviewer.
>
> You write "It does not show any string". Where do you expect or want to
> appear the output which you otherwise would send to an output window?
>
> > Can someone help me if System.out.println does not work in applet or
> > toher reasons?
>
> System.out.println does work in an applet, and I often use that command for
> testing my applets because I am not very familiar with jdb and the -debug
> flag of appletviewer.
>
> --
>
> Hans Kamp (Win2000)
> in...@hanskamp.com
> www.hanskamp.com

--

henri.benoit.vcf

nir

unread,
Aug 14, 2000, 3:00:00 AM8/14/00
to
Well, you can't c the output as part of the applet but u can c your output
in your "JAVA CONSOLE" ( usualy is done for debug). If u want to c your
string, use the g.drawString or other awt features (like label and etc)

good luck

MelixrKrist

unread,
Sep 8, 2000, 3:22:09 PM9/8/00
to
On Mon, 14 Aug 2000 15:03:30 +0200, "nir" <n...@egocentricity.com>
wrote:

Make shure your Java console is enabled in your browser prefs..

0 new messages