Results 1 to 2 of 2
  1. #1
    Join Date
    May 2011
    Posts
    1
    Rep Power
    0

    Post Cloud not find the main class

    I am tryin to build a simple java program as mentioned below :

    public class Hi
    {
    public static void main (String a[])
    {
    System.out.println("Hi babe!!");
    }
    }

    the notepad file is however is saved as name of the Class me using here.

    I however compiled it with no error.

    But When i try to execute the Class file

    i getting this error :confused:

    1) Is there any sort or version difference with the JDK i downloaded i.e. 1.6
    2)There is another question when i try to use
    set path = "C:\ program file\java\jdk1.6\bin"

    How can i conclude that the path is set?

    I mean there could be possibility that i can try to compile the java file
    But that is not happening:( .

    3)if the path is set completly can my java file in D: be compiled ?

  2. #2
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,574
    Rep Power
    12

    Default

    It's hard to answer your questions as they stand. Could you post

    (1) The exact full path of the Hi.java file. And verify that the file really is Hi.java and not anything else. (WindowsExplorer is pretty useless for this: check the name from the command line with the dir command.)
    (2) The exact commands you are using to compile and run the program.

    ------------------

    Versions should not be a big problem here.

    Generally you set the PATH once and for all (rather than "set path = etc" every time you compile). There are instructions for doing this in the JDK Installation Notes (scroll down to "How do I set the PATH permanently?")

    If this is your first time compiling a Java program I strongly suggest to work through the "Hello World" page of Oracle's Tutorial. If you follow those steps exactly and encounter a problem others, here, will know exactly what the context is.

Similar Threads

  1. Could not find main class
    By Karenthian in forum New To Java
    Replies: 7
    Last Post: 03-30-2011, 04:02 PM
  2. Could not find main class
    By yetty4ever in forum New To Java
    Replies: 7
    Last Post: 02-16-2011, 08:38 PM
  3. Could Not Find Main Class (AGAIN!)
    By illjavathat in forum New To Java
    Replies: 54
    Last Post: 10-22-2010, 04:22 AM
  4. couldn't find main class
    By demonoid in forum New To Java
    Replies: 6
    Last Post: 10-10-2010, 03:44 AM
  5. JVM Could not find main class
    By banduskank in forum Advanced Java
    Replies: 2
    Last Post: 06-24-2008, 09:05 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
  •