File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes NoClassDefFoundError Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "NoClassDefFoundError" Watch "NoClassDefFoundError" New topic


Jon Camilleri
Ranch Hand

Joined: Apr 25, 2008
Posts: 662

Any idea why the code here is returning an error, when trying to compile it from the command line?

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

javac: file not found:
Usage: javac <options> <source files>
use -help for a list of possible options


Exception in thread "main" java.lang.NoClassDefFoundError: GridBagLayoutDemo/java
Caused by: java.lang.ClassNotFoundException:
at$ Source)

at Method)
at Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: Program will exit.

Basically, I was trying to understand whether changing the GridBagConstraints would have a visual impact on the display:

Steve Fahlbusch

Joined: Sep 18, 2000
Posts: 596

Well the first thing would be that your java command is referencing your source file.
Wim Vanni
Ranch Hand

Joined: Apr 06, 2011
Posts: 96

The fact that the class is part a of a package 'layout' translates into a folder structure that you don't seem to follow.
Just noticed Steve is responding in the same way. That probably means I'm not awfully wrong in my answer

I agree. Here's the link:
subject: NoClassDefFoundError
It's not a secret anymore!