0

I try in the terminal

java '/home/asadefa/Desktop/untitled.class'

and I get a ClassNotFoundException. This is the real path to the class file, compiled from

public class untitled {
public static void main(String[] args) {
        System.out.println("HELLO WORLD!");
    }
}

Can someone please help me? I am using Ubuntu 18.04, and javac worked, but executing it is not working.

My question is different because none of the other answers in the other question are useful to me.

1 Answers1

0

Here is a quote directly from the link that Karel posted.

compile your Java program as before with: javac abc.java. Then run it with:

java abc ## The name of the class to be called is abc NOT abc.class

That being said, you are not supposed to include the ".class" portion of the filename when running the java program. Karel is trying to get you to see that you are including the ".class" but you aren't supposed to.

try the following and see if it works

cd /home/asadefa/Desktop

java untitled

Gordster
  • 1,719