error message when executing

Started by oltbaba, May 04, 2004, 19:50:40

Previous topic - Next topic

oltbaba

i'm new here!
i already installed the lwjgl jar files and everything else into the lib/ext directory.
now i wrote this class.

=================================
package monitor_test;


import org.lwjgl.DisplayMode;
import org.lwjgl.Display;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.Window;
import org.lwjgl.opengl.GL11;

public class Game {
   
   public static void main(String[] args) {
       try {
           int mode = -1;
           DisplayMode[] modes = Display.getAvailableDisplayModes();
           System.out.println("Found " + modes.length + " display modes");
           
       }
       catch(Exception e) {
           System.out.println(e.toString());
       }

   }
=================================

compiling is no further problem but when i execute it i get the following error message:

java.lang.NoClassDefFoundError: Game (wrong name: monitor_test/Game)
       at java.lang.ClassLoader.defineClass0(Native Method)
       at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
       at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
       at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
       at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
       at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
       at java.security.AccessController.doPrivileged(Native Method)
       at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
       at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
       at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
Exception in thread "main" 

does someone know what's the problem?!
any help is welcome!
thx

Optus

When using the package statement at the start of a class, you must also place the java file in a directory that mirrors it.

Example Java file:
package test.monitor;

public class Test1 {
}


Well the file Test1.java must be placed in a directory structure that mirrors the package statement so:
C:/$AppSrc/test/monitor/Test1.java

It looks to me like this is your problem.

oltbaba

holy shit!

thanks thats it!

i think i should take a nap before i continue working