Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Not compiling...

  1. #1
    Junior Member
    Join Date
    Mar 2014
    Posts
    11
    My Mood
    Amazed
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Exclamation Not compiling...

    I'm trying to run a simple code which is to just print out "Hello World", but whenever I run it, a message appears that reads: "Select a way to run Project_1(Which is the Java Project)"

    The selections for it are: Java Applet and Java Application.

    Whenever I click Java Applet it reads: Selection does not contain an applet.

    When I click Java Application: Selection does not contain a main type.

    Here is the code which I believe is correct:
    package packag_1;
     
    public class Num_1 {
    	public static void main(String args){
    		System.out.println("Hello World");
    	}
    }

    Please help!


  2. #2
    Member
    Join Date
    Oct 2013
    Location
    Manila, Philippines
    Posts
    285
    My Mood
    Amused
    Thanks
    6
    Thanked 64 Times in 61 Posts

    Default Re: Not compiling...

    because you don't have a main method.
    your method public static void main(String args) is not a main method for java,
    java's main method should accept a parameter of String array not a String.
    main method should be like this:
    public static void main(String[] args) or public static void main(String args[])
    args there is just the variable name, you can change it to whatever name you want.

  3. The Following User Says Thank You to dicdic For This Useful Post:

    GregBrannon (March 24th, 2014)

Similar Threads

  1. Error while compiling.
    By Troy05 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: July 21st, 2013, 01:16 PM
  2. Help compiling!
    By NoobOfTheMonth in forum What's Wrong With My Code?
    Replies: 3
    Last Post: February 19th, 2013, 07:27 AM
  3. Compiling
    By yavo in forum Java Theory & Questions
    Replies: 1
    Last Post: December 24th, 2011, 07:42 AM
  4. Compiling error
    By tangara in forum Java IDEs
    Replies: 3
    Last Post: September 4th, 2011, 03:00 AM
  5. Help with Compiling
    By w.spidey in forum Object Oriented Programming
    Replies: 10
    Last Post: September 9th, 2010, 01:48 PM