Mac OSX Unable to find *.class file for compilation unit ...

Swing Designer allows you to quickly create the frames, panels, dialogs, applets and other UI elements that comprise Java Swing applications.

Moderators: Konstantin.Scheglov, gnebling, Alexander.Mitin, jwren, Eric Clayberg

Mac OSX Unable to find *.class file for compilation unit ...

Postby mdj » Thu Oct 16, 2008 8:19 am

I am running WindowBuilder Pro 6.8 + Eclipse 3.4 on Java 1.5.0_16-b06-284, Mac OS X 10.5.5. For some of my Java Swing apps, when I switch to designer view and then again when I perform nearly any operation, I get a popup dialog from WIndowBuilder "Unable to find *.class file for compilation unit ... that exists in Java project. Do you have autobuild enabled?". Yes, I have autobuild enabled, and the problem seems related to the use of subclasses of JPanel within my code. These JPanel subclasses are just missing in the design view (hierarchy and layout panes), although they are fine at runtime. The "Unable to find *.class file..." always refers to the class I am viewing, not to the JPanel subclass, but it seems to be occuring only when there a subclassed JPanel elements in the design.

The exact same source files work fine in Win XP (same Eclipse + WindowBuilder version), where the subclassed JPanels are visible in the hierarchy and in the layout panes.

There are no unusual messages in the Eclipse .log.

This is a showstopper on Mac OS X since JPanel subclasses are basically being ignored. Attached are screen clips of the same file opened in Eclispe in Mac OS X and Win XP -- notice that the center content pane is dropped on the Mac.
Picture 2.png
Win XP - note contentPane has a center timelinePanel (subclass of JPanel)
Picture 2.png (48.04 KiB) Viewed 694 times

Picture 1.png
Mac OS X - same file, contentPane has dropped the center panel
Picture 1.png (49.53 KiB) Viewed 695 times


Any suggestions?
mdj
 
Posts: 2
Joined: Thu Oct 16, 2008 7:48 am

Re: Mac OSX Unable to find *.class file for compilation unit ...

Postby Eric Clayberg » Thu Oct 16, 2008 10:05 am

Do the actual .class files exist on disk?

What jDK are you using to compile your code? To run Eclipse?

That error message basically means that one or more of your custom classes can't be found or can't be loaded.

The Designer FAQ lists several possible reasons/solutions for this.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Re: Mac OSX Unable to find *.class file for compilation unit ...

Postby mdj » Thu Oct 16, 2008 2:12 pm

OK, found the problem. I'm running Eclipse 3.4 with JDK 1.5 on Mac OS X (Eclipse 3.4 won't run under (64bit) JDK 1.6, due to its reliance on a 32bit SWT implementation), but I had my project set to use JDK 1.6 for compiling and running, which was generally working fine -- until I tried to use Designer. Eclipse finds the class files just fine and builds and runs the project correctly with the custom JPanel. Only Designer complains about not finding the class file, which I can see is in fact there and runnable.

But when I switched the project over to compile and run with JDK 1.5, Designer stopped complaining and did the right thing -- it found and displayed the custom JPanel. It seems likely to me that the problem really was incompatible class file versions, but that was not clear from either the Designer dialog or the log file. Presumably the reason this didn't show up in Windows is that there I had Eclipse 3.4 running on JDK 1.6, so everything is at the same compiler version.

It seems to me WindowBuilder could be more obvious about the root cause of this problem -- the dialog was definitely misleading!
mdj
 
Posts: 2
Joined: Thu Oct 16, 2008 7:48 am

Re: Mac OSX Unable to find *.class file for compilation unit ...

Postby Eric Clayberg » Thu Oct 16, 2008 2:35 pm

The underlying error comes from the Java (Eclipse) classloader. It does not provide any details on why the class can't be found/loaded.

That is why we have a section in the FAQ discussing the known reasons for this.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA


Return to Swing Designer

Who is online

Users browsing this forum: No registered users and 1 guest