I am on Arch Linux, I just installed JRE and JDK and all the proper bin files (javac and java) are in /opt/java/bin/
I simply compiled a standard hello world, and compiled it with javac running javac ./hello.java
and that made a class.
Now my problem is running it. I run java ./helloworld.class and it gives me an error, even if the file I point java to is non-existant:
Exception in thread "main" java.lang.NoClassDefFoundError: //helloworld/class
Caused by: java.lang.ClassNotFoundException: ..helloworld.class
(..omitted for clarity..)
Could not find the main class: ./helloworld.class. Program will exit.
You will notice the first line of the error, it munges the path //helloworld/class
When I feed java an absolute path, i.e java /home/foo/helloworld.class
it gives the same error, but replaces the path's /
with .
in the first line, again munged.
What do you think is wrong? I really don't know why it is doing this..
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…