63
Welcome back all! 999Destroyer here with another tutorial. Today I'll be showing you how to actually make the "Hello" program we had last time into something we can run outside of Eclipse. The first thing we are going to do is go back to the program we had last time. It should look sort of like Screenshot 1.
Screenshot 1:
Now that we have our program all ready to go, why don't we send it out into the real world? To do this, we are going to right click on our project folder (Hello) and click export [Screenshot 2]. We are then going to click "Java" and make it a "Runnable JAR file" [Screenshot 3].
Screenshot 2:
Screenshot 3:
Click next. Now you can choose where you want to save your folder [Screenshot 4]. When you are done that, click finish. It is OK if you have warnings.
Screenshot 4:
Now we have our program ready to go! Try to run it? You will see nothing happen because the program is running in the background. What you want to do to actually show a console, is make a Batch file. When run, this file will execute our program for us with a console to work with. To make it do this we will first create a text file right where you saved your program called run. We will then go in and write the following inside:
java -jar Hello.jar
pause
This will execute our program. You must now save this file as a .bat file [Screenshot 5]. We can now delete our the .txt and when we double-click the run.bat, it should pull up a console with our program [Screenshot 6].
Screenshot 5:
Screenshot 6:
Once the program is finished, you may press any key to exit. If this helped you please diamond and even favourite as it is very encouraging. If you want to see more, be sure to subscribe and leave comments below on what you want to see next! If you would like to join our development team, be sure to PM me. Thanks for reading and see you next time. Check out tutorial 5, coming out soon!
Screenshot 1:
Now that we have our program all ready to go, why don't we send it out into the real world? To do this, we are going to right click on our project folder (Hello) and click export [Screenshot 2]. We are then going to click "Java" and make it a "Runnable JAR file" [Screenshot 3].
Screenshot 2:
Screenshot 3:
Click next. Now you can choose where you want to save your folder [Screenshot 4]. When you are done that, click finish. It is OK if you have warnings.
Screenshot 4:
Now we have our program ready to go! Try to run it? You will see nothing happen because the program is running in the background. What you want to do to actually show a console, is make a Batch file. When run, this file will execute our program for us with a console to work with. To make it do this we will first create a text file right where you saved your program called run. We will then go in and write the following inside:
java -jar Hello.jar
pause
This will execute our program. You must now save this file as a .bat file [Screenshot 5]. We can now delete our the .txt and when we double-click the run.bat, it should pull up a console with our program [Screenshot 6].
Screenshot 5:
Screenshot 6:
Once the program is finished, you may press any key to exit. If this helped you please diamond and even favourite as it is very encouraging. If you want to see more, be sure to subscribe and leave comments below on what you want to see next! If you would like to join our development team, be sure to PM me. Thanks for reading and see you next time. Check out tutorial 5, coming out soon!
Tags |
tools/tracking
2710299
6
coding-for-noobs-programming-tutorial-series-tutorial-4-exporting-our-program
Create an account or sign in to comment.
Awesome tutorials , also.