Friday 28 June 2013

Create java .bat OR bat file

1. type java program in your java editor like notepad,textpad or jcreator ...
2. Save that java program with .java. Example "Example.java"
3. Open run then type "cmd" prem ok OR open command prompt set you directory
if you save the program in another drive then type like this ...

C:\Users\Swati>f:

here "C:\Users\Swati>" is defoult path and with "f:" it will change the driver ...
Now you will get your destination driver like

F:\>

As show in image ...











4. Then set the path of java bin folder as show in image ...

5. Then complie program like "javac first.java" ... as show in image

6. In the last run program like "java first" ...  as show in image

7. Now you get the out put of your java program ...
8. Now for creating you java bat file, click on the left-top conrer of command prompt and then click on edit section and then click on the "select all"... it will display as show in image

9. Then again , click on the left-top conrer of command prompt and then click on edit section and then click on the "copy" ...
10. Now open "notepad" and paste that matter in note pad ... it will seen like this as show in image ...

11. Now Delete unwanted data and make new look of data as show in image ...

12. now type "pause" in last of data as shown in image ...

13. If you save your java file with any name like "Example.java" so take that name like "example" ... Here I'm save my file with "first.java" so I'll take name "first" and save file as "fist.bat" ... it means you have to save that notepad file like "Example.bat" ... as show in image


14. Your .bat file is ready ... double clicking on .bat file java program will compile and run ...

No comments: