aspose file tools*
The moose likes Applets and the fly likes ClassDefNotFoundError - wrong name Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "ClassDefNotFoundError - wrong name" Watch "ClassDefNotFoundError - wrong name" New topic
Author

ClassDefNotFoundError - wrong name

Martin Asenov
Ranch Hand

Joined: Aug 05, 2009
Posts: 34
Hello again, friends!

For 2 days I can't solve that problem. When importing applet on JSP page, I always get this error, no matter what I do... Please, help...

So, here's the java console's output:



Here's my JSP content:



Here is my init tag:



I have a Dynamic web project, and the package path is the following:

com.company.project.importer.ui.context.ITUIView.class

Of course the class file is located under build/ (package path)

The mistake surely is not spelling mistake, it's something else...

Thank you in advance!

Best regards,
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42608
    
  65
Two things:

Firstly, InitContext is executed on the server, so "Toolkit.getDefaultToolkit().getScreenSize()" tells you something about the server, not the client.

Secondly, I'm guessing that "java:com/company/project/importer/ui/context/ITUIView.class" should read "java:com.company.project.importer.ui.context.ITUIView". I'd advise to use an APPLET tag, though, not an OBJECT tag - it's much better supported these days.


Ping & DNS - my free Android networking tools app
Martin Asenov
Ranch Hand

Joined: Aug 05, 2009
Posts: 34
Ulf Dittmer wrote:Two things:

Firstly, InitContext is executed on the server, so "Toolkit.getDefaultToolkit().getScreenSize()" tells you something about the server, not the client.

Secondly, I'm guessing that "java:com/company/project/importer/ui/context/ITUIView.class" should read "java:com.company.project.importer.ui.context.ITUIView". I'd advise to use an APPLET tag, though, not an OBJECT tag - it's much better supported these days.


Isn't APPLET tag deprecated by W3?

P.S. gives a classnotfoundexception by doing it the way you proposed...
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42608
    
  65
Isn't APPLET tag deprecated by W3?

Possibly, but the important authority when it comes to embedding applets in web pages is not the W3C, but Sun. Both OBJECT and EMBED should be avoided in favor of APPLET, which works much better cross-platform and cross-browser.
Martin Asenov
Ranch Hand

Joined: Aug 05, 2009
Posts: 34


My packages really are com.company.project.importer.ui.context. And in 'context' my class is located that extends JApplet. I can't really figure out where the problem comes from.... Should I include build/classes in the path? Because I did so and nothing really changed.




Thanks...
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42608
    
  65
<applet codebase=\"com/company/project/importer/ui/context/\" code=\"ITUIView\""

That's not how it works. The code attribute must contain the fully-qualified class name. Get rid of the codebase attribute, and change the code attribute to read "com.company.project.importer.ui.context.ITUIView".
Martin Asenov
Ranch Hand

Joined: Aug 05, 2009
Posts: 34


I did what you told me...

Same thing, buddy... I got despared...

;-(

It even came up with a new error, without doing anything:



I just don't know...
Martin Asenov
Ranch Hand

Joined: Aug 05, 2009
Posts: 34
I restarted the FireFox and launched the project again. That appears on screen :
Seems it's stuck and doesn't do anything in background.

I don't know what to do... No warnings or errors pop up from anywhere...

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42608
    
  65
http://localhost:8080/importer-tool-eclipse/com/company/project/importer/ui/context/ITUIView.class

Can you download this file manually by pasting the URL into a browser?
Martin Asenov
Ranch Hand

Joined: Aug 05, 2009
Posts: 34
No... It comes up with 404...

It's located under src/ not under Web Content/ is that a problem?!
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42608
    
  65
Of course that's a problem. The browser/JVM must be able to download the class file. After all, the applet tag tells it where to look for them.
Martin Asenov
Ranch Hand

Joined: Aug 05, 2009
Posts: 34
And how am I supposed to connect the View (applet) with the Controller and the Model that are in packages under /src ...?

Or it just takes the code from there, to know what to paint..?

P.S. Oh God, I put the classes regarding the applet in a jar and a new problem occured:



I don't find any useful information on that issue in google.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42608
    
  65
I'm not following. Whatever files and classes the applet needs must be in publicly accessible directories. If some of those classes are the same ones that are used by the web apps, then they must be deployed to two different locations, one for the applet and one for the web app.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ClassDefNotFoundError - wrong name