Getting Started with Java

Although, technically, I’ve done some Java programming before (around 2008), I’m more or less starting from scratch here. I’m getting set up to write some Java code on my Ubuntu machine (“ooby”). Getting started with Java on a Linux-based system requires the Java SE Development Kit (currently JDK 8) and a text editor. I use nano because I’m a pleb. (I once coded a website entirely in notepad on Windows and made all of the graphics in paint. I’ve since become only slightly more sophisticated.) The JDK can be installed very easily on Ubuntu, with just an apt-get:

14:21 |andrew@ooby java_examples| sudo apt-get install default-jdk

Apparently, this is all that needs to be done. Then, a “Hello World” program can be written (saved as

 * The HelloWorldApp class implements an application that
 * simply prints "Hello World!" to standard output.
class HelloWorldApp {
  public static void main(String[] args) {
    System.out.println("Hello World!"); // display the string.

This can be compiled and run with the following commands:

14:24 |andrew@ooby java_examples| javac 

14:24 |andrew@ooby java_examples| java HelloWorldApp
Hello World!

where the output is seen after the java command. That’s it! All set up to code some Java. Now, to set up the same thing on my MacBook Air (“airy”). I downloaded the JDK for Mac OS (“jdk-8uversion-macosx-x64.dmg”) from this page. You need to create an Oracle account to download this software. Installing the JDK *.dmg file allows the above code to run on Mac OS, as well.


3 thoughts on “Getting Started with Java

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s