This course has already ended.

Java: Programming Environment

Learning Outcomes

We will get to know the programming language used on the course, Java and the programming environment needed. We will also discuss why the programming language used on the course is Java. After the section you are able to set up a Java programming environment for your course work and write and execute a simple Java-program.

Why Java?

It is likely that you have started learning programming with Python. In Tampere University Programming 1 uses Python and Programming 2 C++. Why does Programming 3 use yet another programming language instead of the earlier ones?

Python and C++ are useful to anyone in the field of Computing but it is good for a software developer to have experience in a wide range of programming languages. Additionally Java is one of the most popular programming languages globally. The TIOBE index lists the most popular languages monthly and Java has for a long time been in the top three.

The most important reason for choosing Java is its suitability for studying the learning outcomes of the course. Java is platform independent meaning it aims at being a “write once, run anywhere” high-level programming language. Java is also an object-oriented language and thus provides an opportunity to study the key topics of the course directly through the structures provided by the programming language. The syntax of Java is similar to C++ and C and is thus relatively easy to learn at this point in studies. Java also offers a rich collection of software components in Java class libraries or Java APIs. It is both useful professionally and its features are ideal for the purposes of the course.

Java JDK

In order to implement Java programs you’ll need a Java compiler (javac) and a Java interpreter (java). We will get to know these in more detail a little bit later but let’s first set up the basics so we can get coding. Both the interpreter and the compiler are a part of the Java Development Kit (JDK). The JDK is a development environment for building applications and components with Java. It includes tools for developing and testing Java programs and running them.

JDK is available on university computers and on the remote desktop servers. For your own computer, you might need to install it.

Installing JDK

First let’s check if the JDK is already installed. You can do this by running javac -version and java -version on the command line.

an image showing javac -version executed with result javac 17

JDK 17 installed

The main versions of the JDK can be found on the Oracle web page. The latest version is 17. The Oracle Java License permits personal use and development use at no cost. In addition there is a fully free OpenJDK available under the GPLv2+CPE license. The latter is installed on the university environments.

The JDK is installed by selecting from the available options the one for your operating system and the approprate package for download. For Windows-users the easiest is to use the installation program i.e. the file ending .exe. For Macs the easiet is downloading the disk image i.e. the file ending .dmg. Detailed instructions for the installation for different environments are available on the Oracle web page under Installation instructions.

A simple Java program is written with a code editor into a code file. In Java the file ending is .java. On the command line javac and java are needed to compile and run a Java program. The first compiles the code into bytecode and the second runs it. In practice an integrated development environment (IDE), which in addition to the editor and the ocmpiler contains other tools that help woth coding such as a debugger. IDEs used earlier in studies are pyCharm and Qt Creator. Alternatives suitable for Java include among other Eclipse, IntelliJ IDEA, Visual Studio Code adn Netbeans. Out of these the course uses NetBeans as the example IDE. We’ll get to know it next and write the first Java program.

Posting submission...