View all newsletters
Receive our newsletter - data, insights and analysis delivered to you
  1. Hardware
June 14, 2016updated 22 Sep 2016 12:14pm

Java programming

A quick and simple guide to working with Java.

By James Nunns

As one of the most popular programming languages in the world, Java forms the building blocks for communicating instructions to many machines.

The general purpose high-level language which was developed by Sun Microsystems, now owned by Oracle, is relatively simple to get started with.

Getting started with the programming language a user will require three tools, a Java compiler, a Java Virtual Machine, and the Java API. These can be downloaded from the Oracle site, or by using tools that from a commercial product such as IBM WebSphere Studio Application Developer.

Bundles that include various tools can be downloaded such as the Java Runtime Environment (JRE), and the Software Development Kit (SDK).

The SDK bundle includes all three aforementioned tools and will allow you to create and run Java programs. The JRE bundle includes a Java Virtual Machine and the API, this bundle allows users to run existing Java programs but not create them.

Java

To write a computer program a text editor will be required, which is similar to Microsoft Word but has no formatting.

Content from our partners
Scan and deliver
GenAI cybersecurity: "A super-human analyst, with a brain the size of a planet."
Cloud, AI, and cyber security – highlights from DTX Manchester

Many programmers use Integrated Development Environments (IDEs) to start writing in Java, these are programs such as Netbeans, or Eclipse, although these are not 100% necessary.

To create the first application a user will need to create a source file which contains code that is written in the Java language, compile the source file into a .class file and then run the program.

Numerous tutorials online are available to help speed through the process. Users can simply save a file called HelloWorldApp.java then bring up a command window in order to compile the source file. Enter in the directory where the source file is located and press enter.

Once the source file is located the following command can be entered; javac HelloWorldApp.java. The compiler that you have downloaded will have created a bytecode file, HelloWorld.App.class.

Now that a .class file has been created then the program can be run.

To check that it works, in the same directory type: java -cp . HelloWorldApp, the response should be: C:myapplication>java -cp . HelloWorldApp – Hello World! – C:myapplication>.

First java

 

Websites in our network
Select and enter your corporate email address Tech Monitor's research, insight and analysis examines the frontiers of digital transformation to help tech leaders navigate the future. Our Changelog newsletter delivers our best work to your inbox every week.
  • CIO
  • CTO
  • CISO
  • CSO
  • CFO
  • CDO
  • CEO
  • Architect Founder
  • MD
  • Director
  • Manager
  • Other
Visit our privacy policy for more information about our services, how Progressive Media Investments may use, process and share your personal data, including information on your rights in respect of your personal data and how you can unsubscribe from future marketing communications. Our services are intended for corporate subscribers and you warrant that the email address submitted is your corporate email address.
THANK YOU