Just using some batch commands you can run your file.
Make batch file for running class file :
Copy the following code into notepad and save it as “filename.bat”.
- First line is for compiling the java file if you have class file and don’t want to compile, you can skip first line.
- Second line is for running your class file “>output.txt” will save your output in output.txt file in the same location where your .bat file is saved.
Note: If you have your .bat file in the same location where your java/class file stored then don’t need to give the path.
1: javac your_file_pathTest.java 2: java Test > output.txt
In case you just want to run your class file and don’t want to keep the .bat file in the same location where you have stored your class file then use following code:
1: D: 2: cd JAVAPROGAbstract 3: java Test > output.txt
Your executable file is ready to run your class file , just double click on .bat file and enjoy!!!!
Make batch file for running jar file :
1: java -jar "pathtTesting.jar"