• Post Reply Bookmark Topic Watch Topic
  • New Topic

Compiler Error  RSS feed

 
Berke Seta
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey There!
I've got a problem with the compiler. I don't know, what i do wrong. Could you help me?
Error.jpg
[Thumbnail for Error.jpg]
That's the error
 
Paul Clapham
Sheriff
Posts: 22836
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The message says that class should be in a file named "MooseGreetings.java". What is the name of the file you put that class in?
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch. In the future, please post the text of any error messages instead of screenshots. It makes quoting and searching much easier, or rather, possible in the first place.
 
Paul Clapham
Sheriff
Posts: 22836
43
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since you are a beginner it is quite likely that you don't know how to copy from the Windows command prompt. (And it isn't the same as the way you would copy from any other Windows application.) So here's how you do it:

1. Click on the little icon at the top left-hand corner of the window frame. You will see a drop-down menu which includes an "Edit" option (or its German translation, since it looks like you have a German version of Windows).

2. That option leads to a sub-menu including "Mark". Click on that.

3. Now you can use your mouse (by dragging) to select text which is displayed in the command prompt window. The selected text will be highlighted.

4. Once you have finished selecting, go back to the frame icon and select "Edit" followed by "Copy". Clicking on "Copy" causes the selected text to be put into the system clipboard, from where you can paste it in the normal way (the Ctrl-V key).
 
Campbell Ritchie
Marshal
Posts: 56584
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome again

Use the dir command to see what files you actually have in that directory. If you hsed Microsoft Notepad, it may have added .txt to the name of the file.
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks like you have a source file named test.java that contains a public class MooseGreetings.

The source file must have the same name as the public class that is defined in it. So, rename your source file, it must be named: MooseGreetings.java
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!