Results 1 to 5 of 5

Thread: How do I compile .java into .class?

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2005
    Posts
    43

    Resolved How do I compile .java into .class?

    I dont know how to do this and i dont want that online one, I need to compile them manually (prob from .bat?) If you know how to compile java files it'd be very helpfull if you could post it.

    thanks
    Last edited by NoteMe; Jun 6th, 2005 at 01:49 AM.

  2. #2
    Frenzied Member System_Error's Avatar
    Join Date
    Apr 2004
    Posts
    1,111

    Re: How do I compile .java into .class?

    goto the command line....(Consider you have your path variables set)
    get to the current directory the file is in:
    cd/directory

    then to compile:

    javac FileName.java

    then to run:

    java FileName

  3. #3

    Thread Starter
    Member
    Join Date
    Mar 2005
    Posts
    43

    Re: How do I compile .java into .class?

    I get this error:

    'javac' is not recognized as internal or external command, operable program or batch file.

    I think I have to set it up in my Environment Variables saying the class path to my java, But i dont know what it is :'( Anyway to fix this?

  4. #4

    Thread Starter
    Member
    Join Date
    Mar 2005
    Posts
    43

    Re: How do I compile .java into .class?

    Quote Originally Posted by System_Error
    (Consider you have your path variables set)
    Ah, never saw that, what do you have your path variables set as? I've tried this

    PATH
    C:\Program Files\Java\jdk1.5.0_03\bin

    and it didnt work

    **Edit:

    I played around and it worked! so if someone else is having trouble

    right click "my computer" go to "advance" go to envirmental variables > click on "new" and type this in if you have jdk 1.5.0_03 installed


    PATH
    %:\Program Files\Java\**java version**\bin

    for me it was C:\Program Files\Java\jdk1.5.0_03\bin


    if that doesnt work, do the same thing and estead of typing in PATH, type in JAVAC.


  5. #5
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418

    Re: How do I compile .java into .class?

    You can always use the -classpath switch.
    C:\jdk1.5.0_03\bin> java -classpath C:\classfiledir; classfile

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