I am working along with the ATM Case Study from Deitel java how to program 9th edition.
The case study is at chapter 13, page 546(in case someone has the book and would like to check),I am sure my code is 100% as the book suggested.
I have all the code set but when I try to run the program it is giving me this:
Error: Could not find or load main class come.example.atm.AtmRun
when I tried to compile the class by using terminal from the class path it gave me this error:
localhost:atm user$ javac AtmRun.java
AtmRun.java:5: error: cannot find symbol
Atm theATM = new Atm();
^
symbol: class Atm
location: class AtmRun
AtmRun.java:5: error: cannot find symbol
Atm theATM = new Atm();
^
symbol: class Atm
location: class AtmRun
2 errors
this is the class am running: straight forward but I cant seem to find the problem. any help?
package come.example.atm;
public class AtmRun {
public static void main (String[] args){
Atm theATM = new Atm();
theATM.run();
}
}
UPDATE: when i run the .class file from the bin directory of project using command java AtmRun i get this:
Exception in thread "main" java.lang.NoClassDefFoundError: AtmRun (wrong name: come/example/atm/AtmRun)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
Class Atm has a constructor Atm() and public void run() along with other methods, the class is big so i think its better if I don't post the code it however you can check in the book if you can.
Note: I am using eclipse, other projects and classes work and run properly.