Results 1 to 3 of 3
  1. #1
    gapper is offline Member
    Join Date
    Jan 2008
    Posts
    17
    Rep Power
    0

    Default Unable to compile

    Hello everyone,

    I am new to Java and just started coding. I wrote first class which failed to compile :(

    Java Code:
    public class MainClass {
    
    public static void main(String[] args) {
    System.out.println("Hello World");
    }
    }
    I tried to compilie it using javac command from the console but got this error message:

    Java Code:
    Test.java:5: class MainClass is public, 
    should be declared in a file named MainClass.java
    I hope I have provided sufficient information. Kindly look into this.

    - Gapper

  2. #2
    surenani is offline Member
    Join Date
    Jan 2008
    Posts
    2
    Rep Power
    0

    Wink

    have u saved the application as "MainClass.java"??????????

  3. #3
    CaptainMorgan's Avatar
    CaptainMorgan is offline Moderator
    Join Date
    Dec 2007
    Location
    NewEngland, US
    Posts
    835
    Rep Power
    8

    Default

    Welcome to the Java Forums gapper. Error messages provide excellent clues for you to solve your compilation problems.

    See you around!
    Vote for the new slogan to our beloved Java Forums! (closes on September 4, 2008)
    Want to voice your opinion on your IDE/Editor of choice? Vote now!
    Got a little Capt'n in you? (drink responsibly)

Similar Threads

  1. Unable to get a XAConnection from the DataSource.
    By Eric in forum Enterprise JavaBeans (EJB)
    Replies: 3
    Last Post: 05-16-2008, 11:17 AM
  2. unable to exceute stored procedures
    By geeta_ravikanti in forum JDBC
    Replies: 1
    Last Post: 04-22-2008, 02:39 AM
  3. Unable to view applets on a web browser
    By thejdev in forum Java Applets
    Replies: 2
    Last Post: 03-04-2008, 06:26 PM
  4. Unable to start WEbSphere server using RAD IDE
    By uppaluru in forum Other IDEs
    Replies: 1
    Last Post: 02-13-2008, 07:51 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
  •