Error in compiling Applet

26 views
Skip to first unread message

Daniele Pizziconi

unread,
Feb 2, 2011, 8:31:56 AM2/2/11
to gwtai
Hi,
I have an error when I try to compile a TestApplet. I'm using Eclipse
with GWT 2.1.0.

My project is organized in this way:

com.sintesi.hydra : HydraWebApplication.gwt.xml
com.sintesi.hydra.client : include the entry point
com.sintesi.hydra.shared;
com.sintesi.hydra.server;
com.sintesi.hydra.applet: include the impl of applet

I put TestApplet.java (interface) into client package, and its
implementation class into com.sintesi.hydra.applet, but I got an error
in TestApplet.java that don't find the reference to its implementation
class.

I also tried to move TestAppletImpl.java in the same package of its
interface but in this case I got an error in importing of
javax.swing.JApplet.

my HydraWebApplication.gwt.xml:

<!-- Specify the app entry point class. -->
<entry-point class='com.sintesi.hydra.client.HydraWebApplication'/>

<!-- Specify the paths for translatable code -->
<source path='client'/>
<source path='shared'/>

Is there anybody who could help me?

Jason Greenberg

unread,
Feb 2, 2011, 12:08:16 PM2/2/11
to gw...@googlegroups.com
Can you paste the error message you received while compiling?


--
You received this message because you are subscribed to the Google Groups "gwtai" group.
To post to this group, send email to gw...@googlegroups.com.
To unsubscribe from this group, send email to gwtai+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gwtai?hl=en.


Daniele Pizziconi

unread,
Feb 2, 2011, 12:36:13 PM2/2/11
to gw...@googlegroups.com
In first case (TestApplet interface in client package and its implementation class in other package ) I got this error:

com.sintesi.hydra.server.TwainAppletImpl can not be found in source packages. Check the inheritance chain from your module; it may not be inheriting a required module or a module may not be adding its source path entries properly.

In second case (both TestApplet interface and implementation in client package) I got this error:

javax.swing.JApplet can not be found in source packages. Check the inheritance chain from your module; it may not be inheriting a required module or a module may not be adding its source path entries properly.

Thank you,
Daniele

2011/2/2 Jason Greenberg <ccie...@gmail.com>

Jason Greenberg

unread,
Feb 2, 2011, 12:55:57 PM2/2/11
to gw...@googlegroups.com
The root problem seems to be a GWT issue primarily, it looks to me like you are using Java packages / Classes that are not translatable to GWT client code.   Check your "client" folder for classes that import/use JApplet - that shouldn't be happening.    You have to create your applet in a different project or package.   

Perhaps someone else might comment on what tools are available to actually build the applet with this GWTAI, but i use it strictly to link my existing applet to my GWT client code via Interface.

HTH,

J

Daniele Pizziconi

unread,
Feb 2, 2011, 1:26:14 PM2/2/11
to gw...@googlegroups.com
My Applet is implemented in a different package (com.sintesi.hydra.applet that is out of source GWT translated code) and my interface that extends your applet implementation is in client package. The problem is that the interface seems to not find its implementation class.

Jason Greenberg

unread,
Feb 2, 2011, 1:45:36 PM2/2/11
to gw...@googlegroups.com
When you compile GWT code, why is there an error about JApplet ?  The 2 should not be related

Michael Krog

unread,
Feb 2, 2011, 2:49:51 PM2/2/11
to gw...@googlegroups.com
Hi Daniel.

1:
Im wondering about the package o your AppletImpl. You say its under com.sintesi.hydra.applet, but your error message said 'com.sintesi.hydra.server.TwainAppletImp'.

2:
I think you have referenses in classes under the client to classes outside the client package. Even if you just have an import to a class outside the packages included in your Gwt app(typical client) could be enough for the compiler to cast an exception.

/Michael

Daniele Pizziconi

unread,
Feb 2, 2011, 6:35:47 PM2/2/11
to gwtai
Because GWT don't find javax.swing.JApplet (the implemented class uses
JApplet as in the tutorial) in sources package.

On Feb 2, 7:45 pm, Jason Greenberg <ccie11...@gmail.com> wrote:
> When you compile GWT code, why is there an error about JApplet ?  The 2
> should not be related
>
> On Wed, Feb 2, 2011 at 1:26 PM, Daniele Pizziconi <
>
> daniele.pizzic...@gmail.com> wrote:
> > My Applet is implemented in a different package (com.sintesi.hydra.applet
> > that is out of source GWT translated code) and my interface that extends
> > your applet implementation is in client package. The problem is that the
> > interface seems to not find its implementation class.
>
> > Daniele
>
> > 2011/2/2 Jason Greenberg <ccie11...@gmail.com>
> >>> 2011/2/2 Jason Greenberg <ccie11...@gmail.com>
> >>>>> gwtai+un...@googlegroups.com<gwtai%2Bunsu...@googlegroups.com>
> >>>>> .
> >>>>> For more options, visit this group at
> >>>>>http://groups.google.com/group/gwtai?hl=en.
>
> >>>>  --
> >>>> You received this message because you are subscribed to the Google
> >>>> Groups "gwtai" group.
> >>>> To post to this group, send email to gw...@googlegroups.com.
> >>>> To unsubscribe from this group, send email to
> >>>> gwtai+un...@googlegroups.com<gwtai%2Bunsu...@googlegroups.com>
> >>>> .
> >>>> For more options, visit this group at
> >>>>http://groups.google.com/group/gwtai?hl=en.
>
> >>>  --
> >>> You received this message because you are subscribed to the Google Groups
> >>> "gwtai" group.
> >>> To post to this group, send email to gw...@googlegroups.com.
> >>> To unsubscribe from this group, send email to
> >>> gwtai+un...@googlegroups.com<gwtai%2Bunsu...@googlegroups.com>
> >>> .
> >>> For more options, visit this group at
> >>>http://groups.google.com/group/gwtai?hl=en.
>
> >>  --
> >> You received this message because you are subscribed to the Google Groups
> >> "gwtai" group.
> >> To post to this group, send email to gw...@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> gwtai+un...@googlegroups.com <gwtai%2Bunsu...@googlegroups.com>
> >> .
> >> For more options, visit this group at
> >>http://groups.google.com/group/gwtai?hl=en.
>
> >  --
> > You received this message because you are subscribed to the Google Groups
> > "gwtai" group.
> > To post to this group, send email to gw...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > gwtai+un...@googlegroups.com <gwtai%2Bunsu...@googlegroups.com>.

Daniele Pizziconi

unread,
Feb 2, 2011, 6:38:01 PM2/2/11
to gwtai
1) Yes, I also tried to move TwainAppletImpl to server package (that,
as "com.sintesi.hydra.applet", out of source package of GWT), but I
have the same error.

2) Ok, but I can't move TwainAppletImpl to client package because then
I have this error in TwainAppletImpl:

javax.swing.JApplet can not be found in source packages. Check the
inheritance chain from your module; it may not be inheriting a
required
module or a module may not be adding its source path entries
properly.



On Feb 2, 8:49 pm, Michael Krog <michael.k...@gmail.com> wrote:
> Hi Daniel.
>
> 1:
> Im wondering about the package o your AppletImpl. You say its under
> com.sintesi.hydra.applet, but your error message said '
> com.sintesi.hydra.server.TwainAppletImp'.
>
> 2:
> I think you have referenses in classes under the client to classes outside
> the client package. Even if you just have an import to a class outside the
> packages included in your Gwt app(typical client) could be enough for the
> compiler to cast an exception.
>
> /Michael
>
>
>
> On Wed, Feb 2, 2011 at 7:45 PM, Jason Greenberg <ccie11...@gmail.com> wrote:
> > When you compile GWT code, why is there an error about JApplet ?  The 2
> > should not be related
>
> > On Wed, Feb 2, 2011 at 1:26 PM, Daniele Pizziconi <
> > daniele.pizzic...@gmail.com> wrote:
>
> >> My Applet is implemented in a different package (com.sintesi.hydra.applet
> >> that is out of source GWT translated code) and my interface that extends
> >> your applet implementation is in client package. The problem is that the
> >> interface seems to not find its implementation class.
>
> >> Daniele
>
> >> 2011/2/2 Jason Greenberg <ccie11...@gmail.com>
> >>>> 2011/2/2 Jason Greenberg <ccie11...@gmail.com>
> >>>>>> gwtai+un...@googlegroups.com<gwtai%2Bunsu...@googlegroups.com>
> >>>>>> .
> >>>>>> For more options, visit this group at
> >>>>>>http://groups.google.com/group/gwtai?hl=en.
>
> >>>>>  --
> >>>>> You received this message because you are subscribed to the Google
> >>>>> Groups "gwtai" group.
> >>>>> To post to this group, send email to gw...@googlegroups.com.
> >>>>> To unsubscribe from this group, send email to
> >>>>> gwtai+un...@googlegroups.com<gwtai%2Bunsu...@googlegroups.com>
> >>>>> .
> >>>>> For more options, visit this group at
> >>>>>http://groups.google.com/group/gwtai?hl=en.
>
> >>>>  --
> >>>> You received this message because you are subscribed to the Google
> >>>> Groups "gwtai" group.
> >>>> To post to this group, send email to gw...@googlegroups.com.
> >>>> To unsubscribe from this group, send email to
> >>>> gwtai+un...@googlegroups.com<gwtai%2Bunsu...@googlegroups.com>
> >>>> .
> >>>> For more options, visit this group at
> >>>>http://groups.google.com/group/gwtai?hl=en.
>
> >>>  --
> >>> You received this message because you are subscribed to the Google Groups
> >>> "gwtai" group.
> >>> To post to this group, send email to gw...@googlegroups.com.
> >>> To unsubscribe from this group, send email to
> >>> gwtai+un...@googlegroups.com<gwtai%2Bunsu...@googlegroups.com>
> >>> .
> >>> For more options, visit this group at
> >>>http://groups.google.com/group/gwtai?hl=en.
>
> >>  --
> >> You received this message because you are subscribed to the Google Groups
> >> "gwtai" group.
> >> To post to this group, send email to gw...@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> gwtai+un...@googlegroups.com <gwtai%2Bunsu...@googlegroups.com>
> >> .
> >> For more options, visit this group at
> >>http://groups.google.com/group/gwtai?hl=en.
>
> >  --
> > You received this message because you are subscribed to the Google Groups
> > "gwtai" group.
> > To post to this group, send email to gw...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > gwtai+un...@googlegroups.com <gwtai%2Bunsu...@googlegroups.com>.
> > For more options, visit this group at
> >http://groups.google.com/group/gwtai?hl=en.
>
> --
>
> [image: Qash - The simple online Cash
> register]<http://feeds.feedburner.com/~r/QashBlog/~6/2>
>
> ↑ Grab this Headline
> Animator<http://feedburner.google.com/fb/a/headlineanimator/install?id=amkuad7...>

Michael Krog

unread,
Feb 3, 2011, 12:50:56 AM2/3/11
to gw...@googlegroups.com
Hi.

I think the problem is that it can be very confusing to get a hold of which code runs where.
It's all Java, but some it for the server, some is for Javascript(compiled by GWT) and some is for the applet.

I think the cause of your errors may be that you in your TwainApplet interface has a hard reference to TwainAppletImpl, fx. as an import. If you have this, and it is because you have it because of the @ImplementingClass, please try to remove the import statement and wrile the full package name in the annotation like this:

@ImplementingClass(com.sintesi.hydra.applet.TwainAppletImpl.class)

/Michael

To unsubscribe from this group, send email to gwtai+un...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/gwtai?hl=en.




--

Qash  - The simple online Cash register

Daniele Pizziconi

unread,
Feb 3, 2011, 6:21:35 AM2/3/11
to gw...@googlegroups.com
I'm using that annotation.

Daniele

2011/2/3 Michael Krog <michae...@gmail.com>

Michael Krog

unread,
Feb 3, 2011, 6:23:41 AM2/3/11
to gw...@googlegroups.com
Great.. 
So it works now, or?

/Michael

Daniele Pizziconi

unread,
Feb 3, 2011, 6:27:23 AM2/3/11
to gw...@googlegroups.com
No. The error is just in that annotation.

2011/2/3 Michael Krog <michae...@gmail.com>

Michael Krog

unread,
Feb 3, 2011, 6:28:32 AM2/3/11
to gw...@googlegroups.com
Hi Daniele.

If you want to give me a chance to help you, please supply more info when you reply, like source code etc.

/Michael

Daniele Pizziconi

unread,
Feb 3, 2011, 6:33:48 AM2/3/11
to gw...@googlegroups.com
Thank you Michael.

This is my class interface: TwainApplet.java in client package

package com.sintesi.hydra.client;

import com.google.gwt.gwtai.applet.client.*;

@ImplementingClass(com.sintesi.hydra.applet.TwainAppletImpl.class)
@Height("60")
@Width("350")
@Archive("GwtAI-Client.jar,GwtAI-Demo.jar")
public interface TwainApplet extends Applet {
               
        public void increment();
       
        public void decrement();
       
        public Object getCurrentValue();

}


This is my implemented class, in applet package (out of translated source code of GWT)

package com.sintesi.hydra.applet;

import java.awt.Color;

import javax.swing.*;

import com.sintesi.hydra.client.TwainApplet;

@SuppressWarnings("serial")
public class TwainAppletImpl extends JApplet implements TwainApplet {
        private JTextField _tfCounter;

        public void init() {
                JPanel panelMain = new JPanel();
               
                _tfCounter = new JTextField(20);
                _tfCounter.setHorizontalAlignment(JTextField.CENTER);
                _tfCounter.setText("0");
                _tfCounter.setEditable(false);
       
                panelMain.add(new JLabel("Current count : "));
                panelMain.add(_tfCounter);
               
                panelMain.setBorder(BorderFactory.createTitledBorder("CounterApplet"));
                panelMain.setBackground(Color.WHITE);
               
                getContentPane().add(panelMain);
        }
       
        public void increment() {
                int currentCount = Integer.parseInt(_tfCounter.getText());
                currentCount++;
               
                _tfCounter.setText(currentCount + "");
        }
       
        public void decrement() {
                int currentCount = Integer.parseInt(_tfCounter.getText());
                currentCount--;
               
                _tfCounter.setText(currentCount + "");
        }
       
        public Object getCurrentValue() {
                return _tfCounter.getText();
        }

}


With this configuration my error is in:

@ImplementingClass(com.sintesi.hydra.applet.TwainAppletImpl.class)



2011/2/3 Michael Krog <michae...@gmail.com>

Michael Krog

unread,
Feb 3, 2011, 6:42:51 AM2/3/11
to gw...@googlegroups.com
Hi.

Okay. I dont really know why that would fail, but try changing your:
@ImplementingClass(com.sintesi.hydra.applet.TwainAppletImpl.class)

into:
@AppletClassName("com.sintesi.hydra.applet.TwainAppletImpl")

..and hope for the best. :)

- Michael

Daniele Pizziconi

unread,
Feb 3, 2011, 7:01:25 AM2/3/11
to gw...@googlegroups.com
Now error is disappeared at compile time but when application starts I have this error:


caricamento: classe com.sintesi.hydra.applet.TwainAppletImpl.class non trovata.
java.lang.ClassNotFoundException: com.sintesi.hydra.server.TwainAppletImpl.class
    at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)

Michael Krog

unread,
Feb 3, 2011, 7:29:31 AM2/3/11
to gw...@googlegroups.com
You have some issues with your packages:

caricamento: classe com.sintesi.hydra.applet.TwainAppletImpl.class non trovata.
java.lang.ClassNotFoundException: com.sintesi.hydra.server.TwainAppletImpl.class

One is in the applet package and the other in the server package.

/Michael

Daniele Pizziconi

unread,
Feb 3, 2011, 7:46:08 AM2/3/11
to gw...@googlegroups.com
No, I've post a copy version of error. The error is:

caricamento: classe com.sintesi.hydra.applet.TwainAppletImpl.class non trovata.
java.lang.ClassNotFoundException: com.sintesi.hydra.applet.TwainAppletImpl.class



2011/2/3 Michael Krog <michae...@gmail.com>
Reply all
Reply to author
Forward
0 new messages