• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

NoClassDefFoundError

 
Ranch Hand
Posts: 664
Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 GridBagLayout.java
javac: file not found: GridBagLayout.java
Usage: javac <options> <source files>
use -help for a list of possible options

>javac GridBagLayoutDemo.java

>java GridBagLayoutDemo.java
Exception in thread "main" java.lang.NoClassDefFoundError: GridBagLayoutDemo/java
Caused by: java.lang.ClassNotFoundException: GridBagLayoutDemo.java
at java.net.URLClassLoader$1.run(Unknown Source)

at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown 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: GridBagLayoutDemo.java. Program will exit.

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




 
Bartender
Posts: 612
7
Mac OS X Python
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well the first thing would be that your java command is referencing your source file.
 
Ranch Hand
Posts: 96
Eclipse IDE Oracle Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


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

Cheers
Wim
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic