Running Example Programs

This chapter provides step-by-step instructions of writing a Java program using a text editor, and then compiling and running this program from command prompt. Several Integrated Development Environments (IDEs) are mentioned in this chapter. We have already installed NetBeans. That and Eclipse are the most popular in Java professional practice.

1. Running Example Programs in Windows

These web notes include many example programs. Run them and play with them. To learn programming, fiddle around with example programs and then write some of your own. This chapter shows how to do this in a bare-bones Windows environment.

This chapter repeats some of what was in the previous chapters but with additional detail. If you don't need the detail, skip the chapter.

You don't have to type in the programs to run them. If you can see the program in a browser window, then you can easily copy the program to Notepad (or other editor) and then save it to a file. Once that is done, you can compile and run the program as described in the previous chapter.

There are many ways to create, compile, and run Java programs. This chapter shows just one way to do this.

Chapter Topics:

      • How to copy, paste, compile, and run programs in a Windows 10 environment
      • Starting Notepad and the command prompt
      • Copying text to the clipboard
      • Pasting text from the clipboard to Notepad
      • Saving the text as a source file
      • Running a program


Question 1:

Is it sometimes beneficial to type in a program rather than just copying it?


Source: Bradley Kjell, http://programmedlessons.org/Java9/chap07/ch07_01.html
Creative Commons License This work is licensed under a Creative Commons Attribution-NonCommercial 3.0 License.