Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / June 2005

Tip: Looking for answers? Try searching our database.

Execution Problem (MinGW + GCJ + Win32)

Thread view: 
Kip - 20 Jun 2005 23:50 GMT
Greetings,

I have a sample program on my MinGW system as follows:
gcj -C Ball.java -C Collidable.java -C GamePiece.java -C Paddle.java -C
PaddleBallApp.java -C PaddleBallFrame.java -C PaddleBallPanel.java -C
Trajectory.java -d ../bin

To execute, I change to the directory of the outputted class files and
enter:
$ java PaddleBallApp.class

But I receive the following:
java.lang.NoClassDefFoundError: PaddleBallApp/class
Exception in thread "main"

Any ideas? Thanks

Signature

Kip Warner
Vertigo
http://TheVertigo.com

Alan Krueger - 21 Jun 2005 06:30 GMT
> To execute, I change to the directory of the outputted class files and
> enter:
[quoted text clipped - 3 lines]
> java.lang.NoClassDefFoundError: PaddleBallApp/class
> Exception in thread "main"

(1) You need to set the classpath.
(2) You need to specify the class name, not a .class file.
Kip - 22 Jun 2005 21:04 GMT
> (1) You need to set the classpath.
> (2) You need to specify the class name, not a .class file.

How do I set the classpath and classname? Could you give me an example?

Signature

Kip Warner
Vertigo
http://TheVertigo.com

Alan Krueger - 22 Jun 2005 23:16 GMT
>>(1) You need to set the classpath.
>>(2) You need to specify the class name, not a .class file.
>
> How do I set the classpath and classname? Could you give me an example?

Try typing "java -help" to get command-line help.

In your case try:

    $ java -classpath . PaddleBallApp
Kip - 22 Jun 2005 23:59 GMT
> > > (1) You need to set the classpath.
> > > (2) You need to specify the class name, not a .class file.
[quoted text clipped - 6 lines]
>
>     $ java -classpath . PaddleBallApp

Kip@KIP /c/School/UBC/CPSC 211/Labs/Lab1/src/paddleball
$ ls
Ball.class                         PaddleBallFrame$ExitAction.class
Ball.java                          PaddleBallFrame$GoAction.class
Collidable.class                   PaddleBallFrame.class
Collidable.java                    PaddleBallFrame.java
GamePiece.class                    PaddleBallPanel$BallMover.class
GamePiece.java                     PaddleBallPanel$PaddleMover.class
Paddle.class                       PaddleBallPanel.class
Paddle.java                        PaddleBallPanel.java
PaddleBallApp.class                Trajectory.class
PaddleBallApp.java                 Trajectory.java
PaddleBallFrame$ColorAction.class

Kip@KIP /c/School/UBC/CPSC 211/Labs/Lab1/src/paddleball
$ java -classpath . PaddleBallApp
java.lang.NoClassDefFoundError: PaddleBallApp (wrong name:
paddleball/PaddleBallApp)
       at java.lang.ClassLoader.defineClass1(Native Method)
       at java.lang.ClassLoader.defineClass(Unknown Source)
       at java.security.SecureClassLoader.defineClass(Unknown Source)
       at java.net.URLClassLoader.defineClass(Unknown Source)
       at java.net.URLClassLoader.access$100(Unknown Source)
       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)
       at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Exception in thread "main"

Any ideas?

Signature

Kip Warner
Vertigo
http://TheVertigo.com

Alan Krueger - 23 Jun 2005 00:21 GMT
> Kip@KIP /c/School/UBC/CPSC 211/Labs/Lab1/src/paddleball
> $ java -classpath . PaddleBallApp
> java.lang.NoClassDefFoundError: PaddleBallApp (wrong name:
> paddleball/PaddleBallApp)

You didn't mention what package the class was in.  You'll want to try
the above command in the src directory adding "paddleball/" in front of
the class name.
Kip - 23 Jun 2005 00:26 GMT
> > Kip@KIP /c/School/UBC/CPSC 211/Labs/Lab1/src/paddleball
> > $ java -classpath . PaddleBallApp
[quoted text clipped - 4 lines]
> the above command in the src directory adding "paddleball/" in front
> of the class name.

Thanks. I got it to work =)

Signature

Kip Warner
Vertigo
http://TheVertigo.com



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.