Ask coding questions

← Back to all posts
Help using Java Scanner?
SarahBethBenes (2)

Just a newbie trying to get started. Actually, I copied the code from the tutorial I was using, and it won't run.

I get:

Error: Could not find or load main class Main
Caused by: java.lang.ClassNotFoundException: Main

I had trouble configuring Java on my computer. Is this just a Linux error, or what?

Answered by SixBeeps (3514) [earned 5 cycles]
View Answer
SixBeeps (3514)

the M in the class name needs to be capitalized

SarahBethBenes (2)

@SixBeeps I SWEAR I had already tried that! And then undone. It worked because you told it to!

SixBeeps (3514)

@SarahBethBenes Haha, welcome to programming :)

SarahBethBenes (2)

@SixBeeps I will get Java down this summer. I promised I would. Can't be THAT much different than Python and C++, or the older ones I worked with, right?

I swear I am buying a bunch of rubber ducks to give to my programming class in the fall.

SixBeeps (3514)

@SarahBethBenes Lmao, ducks are the best.

You're about right with the Python/C++ thing. You have the concepts down, it's just translation from there.

SarahBethBenes (2)

@SixBeeps wish me luck - not in passing the Java certification in 3 weeks, but teaching it in the fall.

08KINPLIX (77)

insted of import Scanner try import java.util.*;