This code should load a VetSystem that i've created but instead the compiler comes up with these errors.Code:package AP3.AE3; import AP3.AE3.utils.*; import java.util.Scanner; //import java.io.*; public class RunVetSystem{ // VetSystem vs; // PetOwner currentOwner=null; // Pet currentPet=null; String command1; public void main(String args[]){ // UtilityCode.loadData(vs); System.out.print("Vetsystem> "); // prompt the user for input //System.out.flush(); //Read commands from the input // Scanner s = new Scanner(System.in); // s.useDelimiter("cmd:"); // command1 = s.next(); command1 = "locateOwner"; if (command1== "locateOwner"){ System.out.println("tester"); } if(command1== "listPets"){ System.out.println("tester"); // if (currentOwner!=null) { // for(int i=0; i>currentOwner.petcounter; i++){ // System.out.println(currentOwner.ownedPets[i]); } } // else System.out.println("no currentOwner is set yet"); if(command1== "selectPet"){ System.out.println("tester"); } if(command1== "listMedicalHistory"){} //else{ //throw new NoCommandException("The command you typed was not recognised."); } } }
java RunVetSystem
Exception in thread "main" java.lang.NoClassDefFoundError: RunVetSystem (wrong name: AP3/AE3/RunVetSystem)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
okay thats with most of the code commented out, can anyone see why this would be happening? Is it something to do with the fact that the main isn't static? loadData is a none static method and cannot be used in a static environment. The program compiles fine with no errors.
Social Networking Bookmarks