Results 1 to 11 of 11

Thread: im trying to get started.

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2001
    Posts
    746

    im trying to get started.

    i downloaded the compilers for java and i finnaly figured out how to compile a .java file. but i cant seem to be able to run the file. how do i do this? i have my .java file and .class file in my C drive do the paths to them are C:\Hello.java and C:\Hello.class

    i tried typing in "java Hello" but it gave me and error.
    FlameWave Technologies - internet tools

  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091

    Re: im trying to get started.

    Originally posted by flamewavetech
    i tried typing in "java Hello" but it gave me and error.
    What error would that be?
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2001
    Posts
    746
    Exception in thread "main" java.lang.NoClassDefFoundError: Hello
    FlameWave Technologies - internet tools

  4. #4
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    and you were in c:\ when you tried to run it? Did you package it?
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2001
    Posts
    746
    what do u mean? i just went to run and typed in command and then typed in java Hello
    FlameWave Technologies - internet tools

  6. #6
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    well, if you don't know what packaging is, then its probably not the problem . But, as far as where you are in at the command line...if you have the .class file in c:\ and you are in c:\windows when you type in "java Hello", then it won't work. That's what I meant. It seems like a stupid mistake to make, but it happens sometimes.

    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  7. #7
    Member
    Join Date
    Apr 2001
    Location
    Hamilton, ON, Canada
    Posts
    43
    the jvm can't find your .class file because you didn't specify the classpath (path of the directory where your class files are)

    type this instead

    java -classpath c:\ Hello

  8. #8
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418
    Yeah flamewavetech you have to use either the -classpath comamand line switch ie........ C:\ java -classpath C:\MyClassDir; myProg or set the CLASSPATH environment variable in your autoexec.bat file. *~Note if you change your autoexec.bat file you have to reboot in order for the changes to take effect.

  9. #9
    Hyperactive Member CaptainPinko's Avatar
    Join Date
    Jan 2001
    Location
    London, Ontario, Canada
    Posts
    332

    Talking

    Originally posted by Dilenger4
    *~Note if you change your autoexec.bat file you have to reboot in order for the changes to take effect.
    nah, just call the autoexec again at the command line
    "There are only two things that are infinite. The universe and human stupidity... and the universe I'm not sure about." - Einstein

    If you are programming in Java use www.NetBeans.org

  10. #10
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744
    NT/2000/XP don't have Autoexec.bat. You will have to use Environment tab from the System control applet (or press Windows Key + Pause)

  11. #11
    Lively Member
    Join Date
    Feb 2001
    Location
    Jutland, Denmark
    Posts
    71
    Remember to put a . (dot) after the last path in the classpath or Java can't see your current folder

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width