JDK Problem


Last Updated:

  1. VerizonLover

    VerizonLover Member This Topic's Starter

    Joined:
    Aug 27, 2010
    Messages:
    12
    Likes Received:
    1
    I'm just starting with Java programming (with "Teach Yourself Java 6 in 21 Days", but I'm stumped at the beginning. It won't let me run any java files!

    I know my classpath is set incorrectly, but what do I need to set it to?

    I have the JDK installing in "C:\Program Files (x86)\Java\jdk1.6.0_21" and the JRE installed in "C:\Program Files (x86)\Java\jre6". But every path I try it gives me an error: "Could not find the main class". Using the command 'java <file name>" What do I do? I have tried setting to the lib directories of both, but no dice. Please help. I'm running the 'java' command from the jdk's bin directory. I also have the JDK's 'bin' directory in my path.

    I have no prior knowledge of programming, BTW.

    After finishing that book, I'm going to start "Beginning Android 2"
     

    Advertisement
  2. johnlgalt

    johnlgalt Antidisestablishmentarian VIP Member

    Joined:
    Oct 28, 2009
    Messages:
    9,416
    Likes Received:
    1,919
    The classpath is where you store your .jar or .class files - aka the JAVA source code files.

    Since you're going to be writing programs, you do not want to store your .class files in the same directory as the JDK bin files / lib files, etc.

    make a directory that is easily accessible (C:\classfiles should work) and store all of your source code in there.

    See Setting the class path for more info.
     
  3. VerizonLover

    VerizonLover Member This Topic's Starter

    Joined:
    Aug 27, 2010
    Messages:
    12
    Likes Received:
    1
    solved
     

Share This Page

Loading...