Results 1 to 6 of 6

Thread: Wordpad help.

  1. #1
    Join Date
    Jul 2008
    Posts
    7
    Rep Power
    0

    Default Wordpad help.

    After I write a program in WordPad.

    What are my steps afterward to see the program work?

    How to compile and run?

    What to type in CMD?


    Thank you in advance.

  2. #2
    DevzAbhi's Avatar
    DevzAbhi is offline Member
    Join Date
    Jul 2008
    Posts
    67
    Rep Power
    0

    Default

    go to the command prompt :

    c:\yourdirectory>javac YourFile.java
    to compile
    c:\yourdirectory>java -cp YourFile
    to run

  3. #3
    Join Date
    Jul 2008
    Posts
    7
    Rep Power
    0

    Default

    I type in:

    c:\users\duran\desktop\javac payroll.java
    I get: is not recognized as an internal or external command and, operable program or bath file.

    What am i doing wrong?

  4. #4
    DevzAbhi's Avatar
    DevzAbhi is offline Member
    Join Date
    Jul 2008
    Posts
    67
    Rep Power
    0

    Default

    You have to set the path variable in your enviroment var

    set it to

    c:\your jdk directory \bin

  5. #5
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Quote Originally Posted by JavaNewbie0000 View Post
    After I write a program in WordPad.

    What are my steps afterward to see the program work?

    How to compile and run?

    What to type in CMD?


    Thank you in advance.
    Here are the steps you have to follow.

    1. Save the file, file name should be same as your class name
    2. Open the command prompt and change the working directory to the java file saved location
    3. Set the Java class path to that folder
    4. Simply type the following command.

      Java Code:
      path=C:\Program Files\Java\jdk1.6.0_07\bin
    5. Then compile the file as follows

      Java Code:
      javac file_name.java
    6. Then run the file as follows

      Java Code:
      java file_name

  6. #6
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Quote Originally Posted by JavaNewbie0000 View Post
    I type in:

    c:\users\duran\desktop\javac payroll.java
    I get: is not recognized as an internal or external command and, operable program or bath file.

    What am i doing wrong?
    Read the post #6. There is an easier way to do it. But keep in mind each time you open the command prompt and start works, you have to set the class path manually. If you set the environment variables, no need to do it each time.

Posting Permissions

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