Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / December 2005

Tip: Looking for answers? Try searching our database.

The output of System.out.println in case of an applet

Thread view: 
marcwentink@hotmail.com - 13 Dec 2005 10:53 GMT
I am trying to make an applet, got some java experience but not thát
much. :-(

The applet I have made this far is a 'changed example' from sources the
JTWAIN tool. Presently the applet is loaded into the browser but does
not do anything. I have some idea what the problem is, but how do I get
any information about what is going on, and which call path the
application follows?

In the application, there are several calls to System.out.println, and
System.err.println but their outputs are not seen anywhere. Which I can
imagine since the applet does not have a console window. (For instance,
in the code below, where does the output of
System.out.println("Init."); go then??

Also I have tried to use the Graphic class, but I cannot use it in
functions that have not initialized graphics. And since it is a
abstract class ( what is that anywy, a sort of static, a singleton for
the whole applet?) I cannot instantiate it, I got the message
"java.awt.Graphics is abstract; cannot be instantiated".

In short how can I get some output when running the code below:

Thank in advance, Marc

import java.applet.Applet;
import java.awt.HeadlessException;
import java.awt.Image;
import java.awt.*;

import com.asprise.util.jtwain.Source;
import com.asprise.util.jtwain.SourceManager;

/*
* $Id$
*
*/

/**
* @author     JACK    (Jan 19, 2004)
*/
public class JTwainApplet extends Applet {

    /**
    * @throws java.awt.HeadlessException
    */
    public JTwainApplet() throws HeadlessException {
        super();
        // TODO Auto-generated constructor stub
    }

    public static void main(String[] args) {
    }
    /* (non-Javadoc)
    * @see java.applet.Applet#destroy()
    */
    public void destroy() {
        // TODO Auto-generated method stub
        super.destroy();
    }

    public void scan() {
            try {
                //
SourceManager.setLibraryPath("E:\\Twain\\Asprise\\JT\\Debug\\JT.dll");
                Source source = SourceManager.instance().getDefaultSource();

                if(source == null) {
                    System.err.println("There is no (default) source on the system!");
                    return;
                }

                source.open();

                Image image = source.acquireImage();

                new ImageDisplayer("DemoSimple", image);

                source.close();

            }catch(Exception e) {
                e.printStackTrace();
            }finally{
                SourceManager.closeSourceManager();
            }
    }

    /* (non-Javadoc)
    * @see java.applet.Applet#init()
    */
    public void init() {
        super.init();

        System.out.println("Init.");

        scan();

        System.out.println("Scan");
    }

    /* (non-Javadoc)
    * @see java.applet.Applet#start()
    */
    public void start() {
        // TODO Auto-generated method stub
        super.start();
    }

    /* (non-Javadoc)
    * @see java.applet.Applet#stop()
    */
    public void stop() {
        // TODO Auto-generated method stub
        super.stop();
    }
}
Thomas Fritsch - 13 Dec 2005 12:02 GMT
marcwentink@hotmail.com schrieb:
> I am trying to make an applet, got some java experience but not thát
> much. :-(
[quoted text clipped - 10 lines]
> in the code below, where does the output of
> System.out.println("Init."); go then??
Browsers usually have a Java console which you can pop up. System.out
and System.err will go there.
In Internet Explorer: Menu "Extras" -> "Sun Java Console"
In Mozilla: Menu "Extras" -> "Web development" -> "Java Console"
(I hope I've translated my browsers' german terms correctly into english)

Signature

"Thomas:Fritsch$ops:de".replace(':','.').replace('$','@')

marcwentink@hotmail.com - 13 Dec 2005 12:36 GMT
Thomas:

> In Mozilla: Menu "Extras" -> "Web development" -> "Java Console"
> (I hope I've translated my browsers' german terms correctly into english)

Thanks you Thomas, thanks a lot, I know about the Java Console, just
not how to start it, apart from right clicking somewhere, sometimes....

Now, I can see the output. But I can only find the Java Console in
Internet Explorer. I have got Mozilla Firefox 1.0.6, in English. I can
find 'Tools', 'Javascript console', but no Java Console.

If you just give me the terms in German. I can speak German. May-be I
can find them.

By the way, I could write German too, but this group is probably
English oriented, and I would make fractionally more grammatical
mistakes then I do in English. :-)
Roedy Green - 13 Dec 2005 13:18 GMT
On 13 Dec 2005 04:36:09 -0800, "marcwentink@hotmail.com"
<marcwentink@hotmail.com> wrote, quoted or indirectly quoted someone
who said :

> have got Mozilla Firefox 1.0.6, in English. I can
>find 'Tools', 'Javascript console', but no Java Console.

see http://mindprod.com/jgloss/console.html
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Thomas Fritsch - 13 Dec 2005 13:24 GMT
> Now, I can see the output. But I can only find the Java Console in
> Internet Explorer. I have got Mozilla Firefox 1.0.6, in English. I can
> find 'Tools', 'Javascript console', but no Java Console.
>
> If you just give me the terms in German. I can speak German. May-be I
> can find them.

In my german Mozilla 1.7.12 it is:
  Menu "Extras" -> "Web-Entwicklung" -> "Java-Konsole"
  (just below "JavaSkript-Konsole")
For some reason your Mozilla seems not to be java-enabled.

When looking into "Help" -> "About Plug-ins" I see
  Java Plug-in 1.5.0_04 for Netscape Navigator (DLL Helper)
and a whole bunch of other Java Plug-ins.

Signature

"Thomas:Fritsch$ops:de".replace(':','.').replace('$','@')

Thomas Fritsch - 13 Dec 2005 13:43 GMT
> By the way, I could write German too, but this group is probably
> English oriented, and I would make fractionally more grammatical
> mistakes then I do in English. :-)
By the way: should be "than", not "then". :-)

Signature

"Thomas:Fritsch$ops:de".replace(':','.').replace('$','@')

marcwentink@hotmail.com - 13 Dec 2005 14:04 GMT
Thomas

> By the way: should be "than", not "then".

Yes, that's true, anyway, I solved the problem by

"In Firefox, you enable it with: Tools | Options | Web Features |
Advanced | Enable Java. You also have to turn on the console with
Windows Start | Settings | Control Panel | Java | Advanced | Show
Console."

>From the link I got. So thanks all.
Mark Thomas - 13 Dec 2005 16:56 GMT
> Now, I can see the output. But I can only find the Java Console in
> Internet Explorer. I have got Mozilla Firefox 1.0.6, in English. I can
> find 'Tools', 'Javascript console', but no Java Console.

When you run an applet in Firefox, does a little coffee cup symbol
appear on your Windows taskbar?  (Excuse the assumption that you are
running under Windows.)  If so, right-click it, and choose 'Open Console'.

Mark
Marc - 13 Dec 2005 18:54 GMT
"Mark Thomas" <anon> schreef

> When you run an applet in Firefox, does a little coffee cup symbol appear
> on your Windows taskbar?

Sometimes it does, sometimes it does not.....

That is how I know the java console, exactly that little coffee cup symbol.
But why it did not appear while I still got this error, I do not know. There
must have been something wrong with the browser settings that it did not
appear, but java was switched on in the firefox browser that was not the
problem.

Anyway, got it now, thanks really a lot for all the suggestions!! Really
thanks a million. I know more or less what I should do to get the software
working, just these little things get you stucked for hours sometimes. So
again, thanks a lot. :-)


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.