How do we use Java?

So how do we produce Java programs? Java is a text  based language, so the first step is to write the source code for our Java application using a text editor and save that source text in a file. You can use any editor you wish.

Next that source file is passed to the Java compiler. The compiler reads the Java source and checks for errors and if no errors are found, outputs the appropriate bytecode to a second file for execution.

Applications vs Apps vs Applets vs Servlets

An aspect of the Java "write once, run anywhere" design, is that Java programs can be run in one of several execution "models" or "contexts". Java programs can be run as "Applications", "Apps", "Applets" or "Servlets".

Java Language Architecture

Java is a text based programming language. This means source code is written and stored in a text file and then passed through a compiler which produces the executable program (also called the object code). With C or C++ and other languages, the language and resultant executable program is tailored to a specific operating system or hardware platform. For example, a Windows program written in C will only execute on a Windows device and may or may not run on all variations of Windows or Windows devices.

What is Java?

Java is a general purpose programming language developed in the mid 1990s by Sun Microsystems. Java is now owned by Oracle Corp. Java is a text based, object oriented, class based programming language (we will learn what these terms mean later). In addition to the language itself, Java is designed to allow a program to be written once on a selected hardware and operating system platform and then executed on different hardware and operating system platforms through the use of virtual machine technology.

What is an SDK?

An SDK, or Software Development Kit, is a package of all of the software tools needed to develop programs for a particular computer or hardware platform. To write programs for specific computers or robotics platforms you need an API library (as described in the previous lesson), deployment scripts (which help compilation on certain platforms), possibly compilers (to allow for the compilation of the code) or IDE plug-ins (similar to extensions to a web browser). All of these items are needed to produce programs for a specific platform.

What is an API?

Simply put, an API or Application Programming Interface, is a library of pre-written computer programs that simplify the use of software or hardware features. When you look at a robot, there is a lot of low level programming needed to operate motors, read sensors, control valves, all at the binary level. There has to be different low level code for each different hardware component.

How do programming languages make robots work?

In the simple view, robots are mechanical devices controlled by embedded computers. Robots typically employ sensors, to obtain input about their environment and motors or other actuators that allow the robot to act in or alter that same environment. A necessary component of any robot will be a computer (also called a controller) which is running a program that takes the available input and translates it to an appropriate output. In a robot, output typically is physical action: moving a servo, spinning a motor, etc.

What is a programming language?

When we are programming, that is creating a program for a computer to execute, we will use a programming language. Like English or Spanish, a programming language is a written way to communicate with someone (or something). Computer languages allow you to encode the operations you wish to have the computer perform with a syntax (language) that is much easier for you to understand than the numeric language (binary) that computers understand.

What is Programming?

When used in the context of computers, programming generally means the process of creating the instructions that a computer will follow in solving a particular problem or completing some task. The product of programming is a "program", which is a package of instructions that can be executed by a computer.

How do programming languages make computers work?

At the hardware level, computers understand one language, called machine language (also called object code). This is the set of instructions supported by the computer's processor hardware and is specific to each type of processor. This object code language is numeric in nature and expressed in binary, which is a numeric coding made up of only 1s and 0s (base 2). It is very tedious to program in binary, so higher level languages were created to make it easier to create programs.