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.
Printable View
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.
go to the command prompt :
c:\yourdirectory>javac YourFile.java
to compile
c:\yourdirectory>java -cp YourFile
to run
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?
You have to set the path variable in your enviroment var
set it to
c:\your jdk directory \bin
Here are the steps you have to follow.
- Save the file, file name should be same as your class name
- Open the command prompt and change the working directory to the java file saved location
- Set the Java class path to that folder
- Simply type the following command.
Code:path=C:\Program Files\Java\jdk1.6.0_07\bin
- Then compile the file as follows
Code:javac file_name.java
- Then run the file as follows
Code:java file_name