linux - error executing java class file -


i have following file ~/workspace/a/a.java:

package a; public class a{     public static void main(string[]args){         system.out.println("hello world");     } } 

compiling ecj don't give me problems,but error when tring execute:

~/workspace/a $ java exception in thread "main" java.lang.noclassdeffounderror: (wrong name: a/a)         @ 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) ~/workspace/a $ java -cp . exception in thread "main" java.lang.noclassdeffounderror: (wrong name: a/a)         @ 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) 

i tried on linux mint 17 openjdk-7-jre version 7u55-2.4.7-1ubuntu1

as said have structure /workspace/a/a.java open terminal , browse workspace directory type following command

for compiling

javac a/a.java 

for executing

java a.a 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -