What's this CLASSPATH thing?

I am really new to Java. I'm at the very start of a book titled "Teach Yourself Java" and I'm trying execute the first example. This is it:
class Example1 {
public static void main(String args[]) {
System.out.println("This is the output from Example1");
I downloaded and installed Java SE into:
C:\Program Files\Java\jdk1.6.0_11
I defined folder C:\Java Applications and put my first file in there titled Example1.java. I'm Windows XP PRO BTW.
At first it wouldn't compile because it couldn't find command javac. Based an another thread here I went into Start | Control Panel | System | Advanced | Environment Variables and updated variable PATH by adding to the end of it ;C:\Program Files\Java\jdk1.6.0_11\bin. It now compiles. But when I try to execute it with command
java Example1.java I get error Exception in thread "main" java.lang.NoClassDefFoundError.
I've read a dozen threads on this problem and most say something about adding a set CLASSPATH or a -cp command between command java and Example1.java. I've tried about everyone of the solutions but no luck. Where exactly is the main class it can't find? What do I need for it to find it when I execute it?

winke04 wrote:
I am really new to Java. I'm at the very start of a book titled "Teach Yourself Java" and I'm trying execute the first example. This is it:
class Example1 {
public static void main(String args[]) {
System.out.println("This is the output from Example1");
I downloaded and installed Java SE into:
C:\Program Files\Java\jdk1.6.0_11
I defined folder C:\Java Applications and put my first file in there titled Example1.java. I'm Windows XP PRO BTW.
At first it wouldn't compile because it couldn't find command javac. Based an another thread here I went into Start | Control Panel | System | Advanced | Environment Variables and updated variable PATH by adding to the end of it ;C:\Program Files\Java\jdk1.6.0_11\bin. It now compiles. But when I try to execute it with command
java Example1.java I get error Exception in thread "main" java.lang.NoClassDefFoundError.
I've read a dozen threads on this problem and most say something about adding a set CLASSPATH or a -cp command between command java and Example1.java. I've tried about everyone of the solutions but no luck. Where exactly is the main class it can't find? What do I need for it to find it when I execute it?(Probable) solution:
// to compile:
javac Example1.java
// to run:
java -cp . Example1Don't forget the DOT after "-cp"!
Explanation: [http://en.wikipedia.org/wiki/Classpath_(Java)]

Similar Messages

  • What does this "Provisioning" thing?

    under Settings, General, scroll down and right above the "Reset" tab there is a "Profile" tab that says "Headlight Testers". When you touch that it takes you to the "provisioning" screen That shows a large image of the "Settings" icon and says
    HeadlightTesters
    Apple Inc.
    Verified(in green) and a "Remove" button in red next to it.
    Then under that says:
    Received August 13, 2008
    Expires August 13, 2009
    Any idea what this is?

    Yes that MUST be it......I am using beta software that I and the developer have been using and testing before its next release. I had a small feeling that is what it couldve been. Thanks for ensuring me i wasnt going crazy (well i am buuuut.....) lol

  • Going out to Print.....what's this CYMK thing??

    This is perhaps a question for the full Photoshop group but this is a much more friendly group and I'm sure someone will have the answer anyway.
    For the first time ever I've been asked to send out a file to a printers to make xmas cards. I spoke to the Printer and he wants a CYMK flattened TIFF.
    Flatten and TIFF I'm ok with but I'm not sure about the CYMK bit. BTW: I do have Photoshop CS as well as Elements.
    What do I need to do? (Apart from panic :-) )
    Colin

    Colin,
    That's CMYK, it stands for Cyan, Magenta, Yellow, and Black (K). It is the basis for all full-color commercial printing, and the order that color is layed down by a printing press (usually). What your printer is asking for is a color-separated image - but why?
    Without getting into the differences between additive and subtractive color, all digital images are viewed in some form of RGB (red, green, blue) until they are printed. When you send the image to your desktop printer, the driver converts it to CMYK (or CCMMYK in the case of a six-color printer) so that the printer can print the image. When the image is converted from RGB to CMYK is when uncertainty is introduced.
    Basically, your printer is telling you to do the conversion in PS CS so that you can see the color shift after the conversion and make sure that you don't want to tweak the image any further before printing. In fact, many color specialists do their color correction AFTER the image is converted to CMYK, so that the results are far more reliable.
    Once you send the files to your printer as CMYK, then they can generate printing plates - one each for C, M, Y, and K, which are placed on the press. Then they can print your piece. Please keep in mind that this is a very simplified explanation.
    Jay B.

  • So what's this SDK thing about?

    I've heard about this SDK program but I don't really know what it does. Can someone please fill me in?

    The date i've seen listed on multiple rumor sites is February 26th. However, the event rumored to occur that day may not be for the SDK seeing as other (less reliable) rumors push it back to WWDC 2008. Most people speculate that at this event the ipod touch/ iphone SDK will be released along with the new MBP. I think it could be a MacDock, for use with the macbook air. That would really increase MBA sales and would be possible seeing as apple has allegedly received the patent (and i've seen the patent submission) it's like an imac with no guts, that the MBA slides inside of.

  • What's this new thing I'm seeing in my emails which have pictures attached?

    I sent myself some pictures from one email to another but when I opened the email under each photo the was this box under it that had this... ATT00003 and under that it says 23bytes. I have not noticed this before iOS 6. Any one have an idea? 

    Also at the very bottom of the email it says "This message was downloaded as plain text" then under that it says "Download full message" if you tap that and download full message it disappears.

  • What is this and how do I get rid of it? Weird display thing popped up.

    What is this black thing, My kids sat on my computer keyboard and now I have this thing on all of my pages.
    How do I get rid of it?
    Thank you!

    Turn off VoiceOver in the Universal Access or Accessibility pane of System Preferences.
    (119434)

  • There is always a blue screen appears after the Apple logo during the booting process. And then everything is back to normal. What is this thing? Is there something wrong with my screen or something?

    There is always a blue screen appears after the Apple logo during the booting process. And then everything is back to normal. What is this thing? Is there something wrong with my screen or something?

    Nah - that's just the normal boot process.
    Clinton

  • Constant what has this got to do with readingHow to create some thing like

    Q]     IN  the statement
    SABC_ACT_READ(4)               VALUE 'READ',
    Taken from
    http://help.sap.com/saphelp_46c/helpdata/en/fc/eb3d5c358411d1829f0000e829fbfe/content.htm
    SABC_ACT_READ(4) is a of type C , & has a value “4” –what has this got to do with reading   pls explain.
    Q]     How to create some thing like this (event) of our own like say read all alphabets that have “s”  in their string?

    In order to Use the Function Module 'AUTHORITY_CHECK_DATASET' , you need to Pass the Exporting  Parameter ACTIVITY  with a value like given below.
    ACTIVITY
    Access type, with the following possible values:
    - READ: Read file
    - WRITE: Change file
    - READ_WITH_FILTER: Read file using filter functions
    - WRITE_WITH_FILTER: Change file using filter functions
    - DELETE: Delete file
    These values are defined as constants and one such constant is SABC_ACT_READ with a type char and length 4 with a Value of 'READ' .
    The constant is being used in that Function module to check the READ Authorization of the user for the file specified.
    Hope this helps.
    Vinodh Balakrishnan

  • What is this thing?? [PIC]

    what is this thing? the image was taken from ifixit.com and has a red circle, ignore that. but what is the round thing inside the GREEN rectangle?
    http://public.ryanpetersonline.com/macbook.jpg
    It looks like a speaker almost. I put my ears next to the speakers in the back of my MB and they sound too tinny to make the "fuller" (I say that relatively) than what I hear. Thanks!

    actually, i may have answered my own question. It appears to be a midrange-enhancing speaker...
    http://www.123macbook.com/forums/viewtopic.php?=&p=862 is one of the links.
    can anyone confirm this?
    neat. i never knew that! i was wondering why my speaker volume sounded ever-so-slightly off center to the right (that speaker is to the right of the fan)
    Message was edited by: rpeters83

  • My first edition macbook has power and the hard disk runs yet screen is black. Somebody suggest the next thing POWER CAPS LOCK OPTION COMMAND what is this and how can I repair my laptop?

    My first edition macbook has power and the hard disk runs yet screen is black. Somebody suggest the next thing POWER+CAPS LOCK+OPTION+COMMAND what is this and how can I repair my laptop?

    Take it in for service.

  • Everytime i put my iphone into itunes and this thing always come up and i dont know what it mean..... what does this mean "this iphone cannot be vsed becasue the apple mobile devcie service is nt started"

    everything i put my iphone intoitunes and this thing always come up and i dont what it mean.... what does this mean "this ipnobe cannot be Used becasue device service is not started. i wanna restone my iphone becasue i forgot my password to my iphone HHEELLPP

    http://support.apple.com/kb/ts1567

  • HT4623 We're sorry, we are unable to continue with your activation at this time. Please try again later, or contact customer care. What is this thing,i cant connect after upgrade my i phone 3gs to ios 6 from ios 5.1,auchhh,

    We're sorry, we are unable to continue with your activation at this time.
    Please try again later, or contact customer care. what is this thing?i try to upgrade my ios to 6.1 from 5.1.1,after i do this,i cant connect to iTunes although i had and have a internet connection

    This message indicates that your phone was hacked or jailbroken to unlock it.
    Then when you updated/restored your phone it locked back up to the original carrier.
    Only the carrier that the phone is locked to can unlock it.

  • TS1559 what is the best thing to do for this problem? i am tired to find a sulution for this problem, apple please hellp us

    plss help how to fix this problem my iphone 4s wifi is greyed out i do all suggestion that i read but nothing happen, i am Filipino but i am here in Qatar for work i am laborer my salary here is small i save my money to buy this phone but now i cant used my wifi i dont know what is the reason, my ios is 6.1.3 i dont uprade to 7, i read that the cause of this is overheating wifi chip but that time happened iam not using my wifi in a long time maybe 1hour,,pls help what is the best thing to do my phone is out of warranty, pls help,, sorry for my bad english tanx - armando-

    plss help how to fix this problem my iphone 4s wifi is greyed out i do all suggestion that i read but nothing happen, i am Filipino but i am here in Qatar for work i am laborer my salary here is small i save my money to buy this phone but now i cant used my wifi i dont know what is the reason, my ios is 6.1.3 i dont uprade to 7, i read that the cause of this is overheating wifi chip but that time happened iam not using my wifi in a long time maybe 1hour,,pls help what is the best thing to do my phone is out of warranty, pls help,, sorry for my bad english tanx - armando-

  • So i was on my ipod, and then it did this static thing and turned black, or like a blue color and it froze. It wont charge, turn on or off what should i do?

    So i was on my ipod touch 4g , and then it did this static thing and turned black, or like a blue color and it froze. It wont charge, turn on or off what should i do?
    I am really worried about it, and i need it tomorrow !!

    iOS: Not responding or does not turn on - http://support.apple.com/kb/TS3281
    How to reset iPod - http://support.apple.com/kb/HT1320
    http://www.apple.com/support/ipod/five_rs/

  • My Iphone 5 does this weird thing where it just freezes, some random vertical lines show up, and shuts off. Does anyone know what the cause of this is?

    My Iphone 5 does this weird thing where it just freezes, some random vertical lines show up, and shuts off. Does anyone know what the cause of this is?

    Backup and restore your software via iTunes. If the problem continues, restore as a NEW device. If this solves it, that means there is some corruption in your backup file, or maybe it's one of your apps causing the trouble. If the problem is still there, you should take it to the Genius Bar at an Apple Store for evaluation.

Maybe you are looking for