-1

I am just learning Java and use Eclipse. I have a question that I can not find an answer to.

Why does eclipse require me to use a project? I am using eclipse now to learn Java, and that means compiling my source.

Problem being that when I add another source file Eclipse compiles both applications. This means (and I could be very wrong here) I need to create a project for every new program I write.

Why can I not just create and compile programs without a project?

krodmannix
  • 845
  • 10
  • 30

1 Answers1

0

What are you missing is called 'Run Configurations'.

  1. Create a project.
  2. Write your multiple programs within this one project. (Presumably, these programs might share some class files or other resources.)
  3. Each of your programs will contain a class file with an entry point, for example, a main() method.
  4. Open this class file and right-click. Select 'Run As', then the most appropriate option.

Following this you will see your Run Configurations here:

enter image description here

Click the drop-down icon and select the Run Configuration that you want to execute. Select 'Run Configurations...' if you want to add program arguments or making other changes.

martinez314
  • 12,162
  • 5
  • 36
  • 63