6

I am trying to compile one file in a java project, but I am seeing other result (result of another file ) in console. I even tried Ctrl + F11 but the same thing happened

In the dropdown of Run button of Java I am not finding the current file name but if I start a new project and run the file it is compiling. Note:I am a beginner in Java.

rink.attendant.6
  • 44,500
  • 61
  • 101
  • 156
madhu131313
  • 7,003
  • 7
  • 40
  • 53

2 Answers2

1

In addition to the info in the answer already selected, others having this or a similar problem should chech the "Run Configurations" panel to make sure the setting are correct for the app you are launching. Check

Run Configurations

Run Configurations

Java42
  • 7,628
  • 1
  • 32
  • 50
0

Your class has to define a public static void main(String[] args) method. Then find the Java file in the project explorer, right-click on it, and choose "run as Java application".

Axel
  • 13,939
  • 5
  • 50
  • 79
  • can I save this file with either names.PassOb.java or Block.java http://pastebin.com/t7Jq9sdm – madhu131313 Mar 11 '13 at 22:07
  • The file name has to be the same (+ extension ".java") as the public class (or interface) defined inside the file. – Axel Mar 13 '13 at 09:16