unix - could not find the main class java error -


i having trouble not find main class error complicated program working on. eliminate possible problems decided try hello world program see if work. working on server i'm pretty sure running red hat enterprise 6. followed these steps provided bart kiers in answer this question:

  1. create file called helloworld.java;
  2. paste code posted below
  3. inside helloworld.java: compile executing command: javac helloworld.java in same folder helloworld.java in;
  4. execute code doing: java -cp . helloworld in same folder helloworld.java in.

i following error after last step:

    exception in thread "main" java.lang.noclassdeffounderror: helloworld/ caused by: java.lang.classnotfoundexception: helloworld.         @ java.net.urlclassloader$1.run(urlclassloader.java:217)         @ java.security.accesscontroller.doprivileged(native method)         @ java.net.urlclassloader.findclass(urlclassloader.java:205)         @ java.lang.classloader.loadclass(classloader.java:321)         @ sun.misc.launcher$appclassloader.loadclass(launcher.java:294)         @ java.lang.classloader.loadclass(classloader.java:266) not find main class: helloworld.. program exit. 

if type java -version, version info displays, suggesting path variable set correctly. have other suggestions things might causing error? thanks!

looks putting period @ end of class name:

java -cp . helloworld. 

do instead

java -cp . helloworld 

Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -