Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Beginning Java and the fly likes Compiles, but showing up Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Compiles, but showing up "NoClassDefFoundError".  Successfully compile and run for other programs." Watch "Compiles, but showing up "NoClassDefFoundError".  Successfully compile and run for other programs." New topic
Author

Compiles, but showing up "NoClassDefFoundError". Successfully compile and run for other programs.

john price
Ranch Hand

Joined: Feb 24, 2011
Posts: 495


I "dir" 'd the dir and the class is showing up...I tried compiling and running another program, which worked fine. I restarted MS-DOS and it did the same thing. What is going on?
Thanks,
cc11rocks

EDIT: I tried to run it from a JAR file. No go.

EDIT2: Getting different output now:


Could it be I have to put it in a package?
EDIT3: The package was the problem.


“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” (Mosher's Law of Software Engineering)
“If debugging is the process of removing bugs, then programming must be the process of putting them in.” (Edsger Dijkstra)
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4163
    
    3

The command java MyJoglCanvasStep1.java will look for a class named java in the subfolder MyJoglCanvasStep1 declared to be in package MyJoglCanvasStep1. Take it from there.

edit: per your EDIT2, the class has been declared to be in package net.sf.breed.mini.jogl.article; Either place it in an appropriate directory structure or remove the package declaration.

Note that the class may have dependencies which also depend on being in the correct place in the filesystem.

edit2: ok then


luck, db
There are no new questions, but there may be new answers.
john price
Ranch Hand

Joined: Feb 24, 2011
Posts: 495

Darryl Burke wrote:The command java MyJoglCanvasStep1.java will look for a class named java in the subfolder MyJoglCanvasStep1 declared to be in package MyJoglCanvasStep1. Take it from there.

edit: per your EDIT2, the class has been declared to be in package net.sf.breed.mini.jogl.article; Either place it in an appropriate directory structure or remove the package declaration.

Note that the class may have dependencies which also depend on being in the correct place in the filesystem.

The first line of the code (I'm trying to figure out JOGL) said "package ******** blah blah blah". My bad that I didn't see that.
Thanks for the help,
cc11rocks aka John Price
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Compiles, but showing up "NoClassDefFoundError". Successfully compile and run for other programs.
 
Similar Threads
Packages
Run class file error
running with command line
Test class cannot find other class
Do I need to reinstall Java?