Download on Amazon
|Source code Info About this book Required Knowledge|
The souce code of this book contains all the examples, quizzes and the assignments of the book “Learn Java and Master Writing Code”.
All the code of the 2nd edition of this book is in the file learn_java_v02.zip. If you unzip the file you will see two folders namely, src (the source code) and bin (the machine code). The machine code is created automatically after the source code is compiled, that’s why you need only the src folder.
Setup the source code
To setup the source code you need to install Java and Eclipse first.
Download Java and Eclipse for your computer and operating system.
For Windows 64 bits download
Java: jdk-10.0.2_windows-x64_bin.exe or a later version and
Eclipse IDE for Java Developers: eclipse-inst-win64.exe or a later version.
After successful installation of Java and Eclipse, and running Eclipse, you will see a windows like below. Close the welcome message as shown below.
By closing the welcome message a window like below appears.
The Navigator tab is standard not available, but it is convenient to use it.
Click Window → Show view and click Navigator. The Navigator tab will be visible next to the tab Package Explorer. See the image below!
Create a new project
By Installing Eclipse a folder called workspace would be automatically created in which you can find all your projects. The folder will be standard created in the following path
C:\Users\your user name\workspace
Start a new Java project by clicking on:
File → New → Java Project.
Write the name of the project, for example, learn_java_v02, and then click Finish
Click on the tab Navigator and you will see a window like below. The map src is created automatically and it is empty.
Setup the source code of the book
If you haven’t downloaded the source code, click here to download it now.
Extract the zip file learn_java_v02.zip of the source code, and copy the content of the src directory to the folder C:\Users\your user name\workspace\learn_java_v02\src. The src directory is automatically created within your project learn_java_v02.
If you run Eclipse, the code is not visible within the src directory. Select the tab Navigator → Click with the right mouse button on the src directory of your project and choose refresh to make the code visible.
The folders of the source code will be visible as below.
If you followed all the previous steps correctly, you can now compile and run the code of the book.
Double click for example on the class Car.java inside the map book\_00_introduction\ex01\Car.java. The code of the class Car.java will be visible in the right side of your screen. You can compile and run each code by clicking on the green arrow see the red arrow 1 in the image below to compile and run the current program. After compiling and running the program the result is written to the standard output see the red arrow 2 in the image below.
|Sar Maroof is a professional software development teacher, gives master classes and publishes technical articles. He is also an expert software developer and worked for several big as well as small companies and later as a freelancer.|
Subscribe to Sar Maroof's RSS feeds!
Mail this page to a friend!
Bookmark this page!