Results 1 to 6 of 6
  1. #1
    Triji is offline Member
    Join Date
    Aug 2008
    Posts
    5
    Rep Power
    0

    Exclamation [SOLVED] Eclipse-Run As "Java application" missing!!

    Hi,

    I am very new to Eclipse IDE.
    I have a project imported to my eclipse IDE,but when I try to run any module of the project.I don't see the option "Java Application" under Run->Run As.Though this options works(appears) for certain modules(files).

    Can you please help me out with this!!

    Thanks in advance!!

    -Triji

  2. #2
    drieskn is offline Member
    Join Date
    Jan 2009
    Posts
    5
    Rep Power
    0

    Default

    Hi Triji,

    I am also rather new to Eclipse so this might be too easy: Eclipse will only give you this possibility if there a <code>public static void main(String[] args)</code> method in your program, which makes it an application.

  3. #3
    Steve11235's Avatar
    Steve11235 is offline Senior Member
    Join Date
    Dec 2008
    Posts
    1,046
    Rep Power
    7

    Default

    To expand on what Drieskn said...


    Any public class that has a

    public static void main(String[] args) {
    // do something
    }

    can be "run" from inside Eclipse. Basically, Eclipse executes the "java" command for you.

    A project can have many classes that can be "run". I often make a class able to run just so I can test it.

    You should create one class as the start point for your application and add a main() method to it.

    Eclipse keeps track of the different classes you have selected to run. You can also set all kinds of settings if you need to.

  4. #4
    jaisastha is offline Member
    Join Date
    Jan 2009
    Posts
    6
    Rep Power
    0

    Default

    hi better to go for visual class.
    File-New-Visual ---Super class like --javax.swing.JFrame with main();

    Just try this one.

  5. #5
    Steve11235's Avatar
    Steve11235 is offline Senior Member
    Join Date
    Dec 2008
    Posts
    1,046
    Rep Power
    7

    Default

    I put main() methods in my form classes for testing purposes. However, when I create applications that involve forms, I typically create a MyAppController class with a main() method and create the MyAppForm and MyAppModel classes from the controller. Generally, the the model actually involves several classes at least, and possibly several forms.

    The controller pulls the application together, allowing the form classes to focus on presentation and the model classes to focus on the data. This is called the Model-View-Controller (MVC) design.

  6. #6
    Triji is offline Member
    Join Date
    Aug 2008
    Posts
    5
    Rep Power
    0

Similar Threads

  1. How to "connect" Eclipse with Scilab/MatLab
    By bizmut in forum Eclipse
    Replies: 6
    Last Post: 06-22-2010, 09:59 PM
  2. Java, Military Format using "/" and "%" Operator!!
    By sk8rsam77 in forum New To Java
    Replies: 11
    Last Post: 02-26-2010, 04:03 AM
  3. Replies: 1
    Last Post: 10-20-2008, 08:35 AM
  4. <core:forEach var="" begin="+<%=j%>+">???
    By freddieMaize in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 09-27-2008, 02:20 AM
  5. "Jumble" or "Scramble" Program
    By Shadow22202 in forum Java Applets
    Replies: 8
    Last Post: 04-30-2008, 04:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •