0

Hi i've compile this java project. This is my first project of hello world but when i try to run it on cmd i have this error. Can you help me?

This is my code:

public class CiaoMondo { 
    public static void main(String[] args)
    { 
        // Prints "Hello, World" to the terminal window.
        System.out.println("Hello, World");
    }
}

This is the error:
x

Andreas
  • 154,647
  • 11
  • 152
  • 247
  • don't use links to show code/errors. copy the code into to the question – RAZ_Muh_Taz Aug 29 '18 at 23:00
  • Ops sorry. I've copied the error also, can you help? – Fabio Palladino Aug 29 '18 at 23:02
  • shows us your code, i don't see the code in the question – RAZ_Muh_Taz Aug 29 '18 at 23:02
  • public class CiaoMondo { public static void main(String[] args) { // Prints "Hello, World" to the terminal window. System.out.println("Hello, World"); } } ----------------------------- The code is a simply hello world, into my eclipse console when i run it, it run perfectlly, but when i open cmd and after the compiling with the javac command i have the error – Fabio Palladino Aug 29 '18 at 23:05

1 Answers1

0

A ClassNotFoundException can be caused for several reasons. The most common (in my experience) are because the java ClassName command is blocked by your firewall, or the file your class is in is improperly named.

penelope
  • 1
  • 2
  • My project name is primoprogramma and the only class name is CiaoMondo. I don't recognize the error :( . Then i run javac CiaoMondo.java and java CiaoMondo. But then i've the error – Fabio Palladino Aug 29 '18 at 23:21
  • Does it tell you that CiaoMondo is the missing class, or is it a different one? Most java code needs some kind of import (usually java.io.* for basic console applications) – penelope Aug 29 '18 at 23:31
  • Into the image i linked it says in the end of the error CiaoMondo (wrong name) but the name is that mmh... – Fabio Palladino Aug 29 '18 at 23:34
  • In the image you linked, you seem to have a typo -- you did not capitalize "mondo" in CiaoMondo (typed command was "java primoprogrammajava.Ciaomondo" instead of "java primoprogrammajava.CiaoMondo"). Could this be your error? – penelope Aug 29 '18 at 23:41