Getting Started
- Running the "Hello World" example program from the lecture
All program examples from the lecture (and many more) are
available for you as source code. You are strongly encouraged to look at them,
run them, and to modify them.
During the semester we will encounter a relatively large
number of sample programs, so we needed to organize them somehow. We decided to
use the professional source code management system SVN for this purpose, because
it is easy to use, and because you will most likely encounter it many times
again in your future career. So, any time spent familiarizing yourself with this
tool is time well spent. For now, however, just follow the instructions below to
access the Java programs that we have provided for you.
Hello World
Since the 1970s, it has been a tradition that a beginning
programmer's first program should print "Hello World" on the terminal window.
While this does not seem to be too interesting at first, it is a good way to get
familiar with the programming tools, such as the editor, compiler, execution
environment, or, like here, with the Integrated Development Environment (IDE)
Eclipse.
Simply follow the instructions below, even if you do not (yet)
understand exactly what they do. You'll find out during the semester :-)
1. |
Start Eclipse, e.g. from the Start-Menue. |
... while eclipse loads (which may take a while) you'll
see a splash-screen. Just wait a little ... |
|
|
|
|
|
2.
|
Click (check) the box in the lower left
corner, then press [OK]
|
|
Here
you select the folder where Eclipse stores its data, i.e. files
containing Java source code, executable code, configuration settings.
Its is usually a good idea to choose an empty folder somewhere in your
home directory. |
|
|
3.
|
Select File > Import...
|
|
At
this stage, Eclipse does not yet know that the Java code for the example
programs is located at our department's SVN server.
In the next steps you're going to tell Eclipse ... |
|
|
4.
|
Expand the [SVN] folder at the bottom, select [Checkout Projects
from SVN], then press [Next].
|
|
|
|
|
5.
|
Select [Create a new repository location], then press [Next]
|
|
|
|
|
6.
|
Enter the URL of the SVN repository, which
is
https://svn.informatik.hu-berlin.de/svn/gdp-10/lecture-samples
|
|
|
|
|
7.
|
Press [Accept Permanently]. |
|
To
secure the communication between Eclipse on your computer and the SVN
server in the computer science department, a digital certificate is
needed. Once you have accepted it (permanently), you will not be asked
for it again. |
|
|
8.
|
Enter the Username and Password from your
Informatik account (or Goya account). |
|
You
should already have obtained an Informatik-account in order to sign-up
for this course in Goya. For this course, for the Praktikum and also for
the Übungen, you'll definitely need an account at the department. If you
don't have one yet (or if you forgot your username / password), contact
Gabriele Baerwolff in Rudower Chaussee 25, Haus III, Floor 2. |
|
|
9.
|
Select the top-folder, then press [Finish]. |
|
|
|
|
10.
|
Check [Check out as a project in the workspace] and then press [Finish]. |
Eclipse may take some time to download the source code
from the SVN repository. Just wait!
|
|
|
|
|
|
11.
|
Click [Workbench] on the right side of the
Eclipse window. |
|
Depending
on what you want to do, Eclipse offers several "Views/Windows". For
programming Java, select the "Workbench" view. |
|
|
12.
|
Now Eclipse is properly setup for this
course. It will remember those settings, so you don't need to repeat
steps 1-11 in the future.
You should see the top-level directory "lecture-samples" in the Package
Explorer (left). |
|
|
|
|
13. |
In the Package Explorer (left) expand the top-level folder
"lecture-samples" and navigate to the "HelloWorld.java" file.
Double-click the HelloWorld.java file to load its content into the editor (middle). |
|
|
|
|
14. |
In the tool pane (near the upper left of
the Eclipse window), click on
, then select
[Run As] > [Java Application] in order to compile and run the "HelloWorld" |
|
|
|
|
15.
|
Check [Always launch without asking, then press [Proceed] |
|
Eclipse
informs you that one of the source code files that you just downloaded
contains errors - which need to be corrected at some point in the
future. Don't worry! We introduced these errors
intentionally and will "make use" of them later in the lecture when
we'll discuss debugging.
For now, just ignore the warning. |
|
|
16.
|
Done! Enjoy the friendly "Hello World"
message from your program at the lower/right window! |
|
|
Final Note. Steps 1-12 explain how to setup Eclipse to
download the source code from our SVN server. You only have to do this once.
Later, you may start with Step 13 to compile and run any program right away.
|