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

    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: class MainClass is public, 
    should be declared in a file named
    I hope I have provided sufficient information. Kindly look into this.

    - Gapper

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


    have u saved the application as ""??????????

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


    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, 12:17 PM
  2. unable to exceute stored procedures
    By geeta_ravikanti in forum JDBC
    Replies: 1
    Last Post: 04-22-2008, 03:39 AM
  3. Unable to view applets on a web browser
    By thejdev in forum Java Applets
    Replies: 2
    Last Post: 03-04-2008, 07:26 PM
  4. Unable to start WEbSphere server using RAD IDE
    By uppaluru in forum Other IDEs
    Replies: 1
    Last Post: 02-13-2008, 08: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