To check your Java programs is running too or not type this program :-
class test
{
public static void main(String args[])
{
System.out.println(" Welcome to DK Blog.");
}
}
Copy this program and save this as test.java
and open cmd exactly where your file is saved...
For example my file is saved in desktop , so I have to open CMD in desktop location
Now to run java program type:-
javac filename.java
For example:- My file here is test.java
So I will write in cmd.... javac test.java
Press enter and you'll see a class file will be created name test.class as you can see here in the picture....As you can see my program is successfully compiled , that's why now test.class is created ..
Now all I need is to type java classname to execute this program in cmd...
For example , in the below picture ...
Ohhh I forgot 1 thing to tell you all, if this Java path doesn't seems to be appeared like this in your cmd:-
Then goto right click on This PC or My computer , and select properties and select Advance System settings and select Environment Variable As shown in the pictures below....
Click on path variable and click edit....
Now this'll work on cmd follow Step 6 again....
But I'll recommend you to follow my way , you'll never get issue regarding this PATH variable error....
Enjoyy have a great day....
Enjoyy have a great day....
No comments:
Post a Comment
Do message if anyone having problem regarding this blog, dont write any abusive language about this blog or anyone.