compilation - Java Compiling Error: -


i working along atm case study deitel java how program 9th edition.

the case study @ chapter 13, page 546(in case has book , check),i sure code 100% book suggested.

i have code set when try run program giving me this:

error: not find or load main class come.example.atm.atmrun 

when tried compile class using terminal class path gave me 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 class running: straight forward cant seem find problem. help?

package come.example.atm; public class atmrun {      public static void main (string[] args){         atm theatm = new atm();         theatm.run();     } } 

update: when run .class file bin directory of project using command java atmrun this:

exception in thread "main" java.lang.noclassdeffounderror: atmrun (wrong name: come/example/atm/atmrun)     @ java.lang.classloader.defineclass1(native method)     @ java.lang.classloader.defineclass(classloader.java:800)     @ java.security.secureclassloader.defineclass(secureclassloader.java:142)     @ java.net.urlclassloader.defineclass(urlclassloader.java:449)     @ java.net.urlclassloader.access$100(urlclassloader.java:71)     @ java.net.urlclassloader$1.run(urlclassloader.java:361)     @ java.net.urlclassloader$1.run(urlclassloader.java:355)     @ java.security.accesscontroller.doprivileged(native method)     @ java.net.urlclassloader.findclass(urlclassloader.java:354)     @ java.lang.classloader.loadclass(classloader.java:425)     @ sun.misc.launcher$appclassloader.loadclass(launcher.java:308)     @ java.lang.classloader.loadclass(classloader.java:358)     @ sun.launcher.launcherhelper.checkandloadmain(launcherhelper.java:482) 

class atm has constructor atm() , public void run() along other methods, class big think better if don't post code can check in book if can.

note: using eclipse, other projects , classes work , run properly.

for me worked. please follow below steps:

y:\hashmiab\desktop\trash\test>javac come\example\atm\atm.java  y:\hashmiab\desktop\trash\test>javac come\example\atm\atmrun.java  y:\hashmiab\desktop\trash\test>java come.example.atm.atmrun heloo 

it matters how use -d , -cp options of javac , java commands. didn't use of options.

for more please find directory structure.

+test -+come  -+example   -+atm    -atmrun.java    -atm.java 

thanks.


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -