1

I'm new to Java. I'm following step-by-step Java tutorials from youtube and I'm getting this error message everytime I try to run it but I'm literally copying codes what he writes in the video and still getting an error. I'm using Netbeans.

Error: Could not find or load main class javaapplication1.JavaApplication1
C:\Users\Otto\AppData\Local\NetBeans\Cache\8.2\executor-snippets\run.xml:53: 
Java returned: 1
BUILD FAILED (total time: 0 seconds)

My code:

public class HelloWorld {
public static void main(String[] args) {
  // Prints "Hello, World" in the terminal window.
  System.out.println("Hello, World");
  }
  }
Otar Jibladze
  • 95
  • 1
  • 7
  • https://stackoverflow.com/questions/20034377/netbeans-error-could-not-find-or-load-main-class – widavies Aug 29 '18 at 14:46
  • OK I tried every solution they posted on that link but It didn't work. – Otar Jibladze Aug 29 '18 at 15:01
  • You need to provide more information. Update you post to show: [1] The source of the class containing the `main()` method that you are trying to run. [2] A link to the tutorial on YouTube that you are using. – skomisa Aug 29 '18 at 16:14
  • Try creating a new project and then just copy and paste your code over from your old project. – widavies Aug 29 '18 at 16:37
  • I updated post. It's the most simple code. I can link tutorial but it's in Russian so I think there is no point in linking that. Thanks – Otar Jibladze Aug 29 '18 at 17:53
  • I fixed problem. I had a mistake in my code and after I changed the code error does not come anymore. Thanks anyway – Otar Jibladze Aug 29 '18 at 18:40
  • OK. (It looks like the class you wanted to run, **HelloWorld**, did not match the class that was being run, **JavaApplication1**.) – skomisa Aug 29 '18 at 19:06

0 Answers0