8 Replies - 4484 Views - Last Post: 02 September 2011 - 11:59 PM Rate Topic: -----

#1 Jexpos  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 7
  • Joined: 02-September 11

Eclipse Issue

Posted 02 September 2011 - 07:31 PM

Hello DIC, when I try to run my code in Eclipse it comes up with a box that says "Launch configuration EmailValidation references non-existing project Jexpo." That was an older program I was testing and now even with it deleted it wants to run that instead of what I am trying to run. The main problem is it won't let me run my program and wants to run a deleted program instead.

Attached image(s)

  • Attached Image

This post has been edited by Jexpos: 02 September 2011 - 07:33 PM

Is This A Good Question/Topic? 0
  • +

Replies To: Eclipse Issue

#2 macosxnerd101  Icon User is offline

  • Games, Graphs, and Auctions
  • member icon




Reputation: 12298
  • View blog
  • Posts: 45,399
  • Joined: 27-December 08

Re: Eclipse Issue

Posted 02 September 2011 - 07:34 PM

Go to your package explorer menu and right click the project you want to run. A menu should pop up. Select the Run As option and go from there.
Was This Post Helpful? 0
  • +
  • -

#3 Jexpos  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 7
  • Joined: 02-September 11

Re: Eclipse Issue

Posted 02 September 2011 - 07:36 PM

Ok I did that and now It says "Section does not contain a main type"
Was This Post Helpful? 0
  • +
  • -

#4 macosxnerd101  Icon User is offline

  • Games, Graphs, and Auctions
  • member icon




Reputation: 12298
  • View blog
  • Posts: 45,399
  • Joined: 27-December 08

Re: Eclipse Issue

Posted 02 September 2011 - 07:37 PM

You need a Main class with a main() method. If a class has a main() method, you should be able to right click it and choose the Run As option.
Was This Post Helpful? 0
  • +
  • -

#5 Jexpos  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 7
  • Joined: 02-September 11

Re: Eclipse Issue

Posted 02 September 2011 - 07:40 PM

Where would I put main into this?

public class Rectangle{

Was This Post Helpful? 0
  • +
  • -

#6 macosxnerd101  Icon User is offline

  • Games, Graphs, and Auctions
  • member icon




Reputation: 12298
  • View blog
  • Posts: 45,399
  • Joined: 27-December 08

Re: Eclipse Issue

Posted 02 September 2011 - 07:41 PM

Anywhere that is legal to define a method.
public class Rectangle{

    public static void main(String[] args){
          //code you want to run
    }
}


Was This Post Helpful? 0
  • +
  • -

#7 Jexpos  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 7
  • Joined: 02-September 11

Re: Eclipse Issue

Posted 02 September 2011 - 07:42 PM

Oh! Thank you!
Was This Post Helpful? 0
  • +
  • -

#8 macosxnerd101  Icon User is offline

  • Games, Graphs, and Auctions
  • member icon




Reputation: 12298
  • View blog
  • Posts: 45,399
  • Joined: 27-December 08

Re: Eclipse Issue

Posted 02 September 2011 - 07:43 PM

Glad I could help! :)
Was This Post Helpful? 0
  • +
  • -

#9 GregBrannon  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2250
  • View blog
  • Posts: 5,340
  • Joined: 10-September 10

Re: Eclipse Issue

Posted 02 September 2011 - 11:59 PM

Of course, you'll have to put something in the main() method that makes the program do something. The nice picture you showed of the class Rectangle looks like it was constructed and heavily commented to show and explain the basic construction of a Java class file. What it actually does or is intended to do, if anything, is not clear, but I doubt you'll just be able to drop a main() method into it and expect great things to happen - at least not with the Rectangle class.

Your conundrum is a good example of why starting with the basic "Hello.java" tutorial is helpful. Upon completing that tutorial, you'd understand the basic elements required to construct a running Java program, and if you're lucky, you'll learn to create and run it from both an IDE, like Eclipse, and the command line (a terminal shell).

Some will point out that you don't have an Eclipse issue as your thread title states, you have a Java issue. Eclipse is just an editor. It's a smart one, and it's customized to work nicely with Java (and many other things). You're doubly confused, because you're trying to learn at least 2 things at once: Java and Eclipse. That's okay, but if your objective is to learn to successfully write Java programs, having to learn Eclipse at the same time may get in the way of learning Java. That's not a big deal if you're not in a hurry.

Good luck and come back for more help.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1