Download Object-Oriented Programming in Java Topic 1: The Java Environment

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Air Force Institute of Technology
Electrical and Computer Engineering
Object-Oriented Programming Design
Topic 1:
The Java Environment
Maj Joel Young
[email protected]
30-Apr-17
Maj Joel Young
Object-Oriented
Programming
Design
The Java Environment
• Java code is compiled to an intermediate form called
“bytecode”
• The bytecode is executed by a simulated computer called the
Java Virtual Machine (JVM)
• The JVM translates bytecode instructions to your machine
Java
Code
Java
Compiler
Byte
Code
JVM
CPU
30-Apr-17
Air Force Institute of Technology
Electrical and Computer Engineering
2
Object-Oriented
Programming
Design
The Java Environment
• Java maintains its portability by keeping the bytecode the
same across all platforms
• The JVM specification is open so that vendors can write one
for their platforms
• JVMs available from Sun, IBM, Microsoft, and others
Byte
Code
JVM
CPU
30-Apr-17
Air Force Institute of Technology
Electrical and Computer Engineering
3
Object-Oriented
Programming
Design
Java Programming Environment
• Sun Microsystems Java Development Kit (JDK)
–
–
–
–
Available at www.java.sun.com
Latest version is JDK 1.4.2
Sun refers to all releases after 1.1.8 as “Java 2”
Contains compiler, JVM, and tools
• Java API Docs: http://java.sun.com/j2se/1.3/docs/api/
• Integrated Development Environments
– Features include specialized editors, debuggers, GUI builders … but be
comfortable with command line first
– Recommended – get up to speed fast
– Eclipse – IBM – http://www.eclipse.org/ (JDK 1.3), libre
– DrJava – http://www.drjava.org/, can interface with Eclipse, libre
– TogetherSoft – R:\Simulations\TogetherSoft (Academic Version)
– JBuilder – www.inprise.com/jbuilder (free version)
30-Apr-17
Air Force Institute of Technology
Electrical and Computer Engineering
4
Object-Oriented
Programming
Design
Example Java Program
class HelloWorld
{
static public void main(String args[])
{
// About the simplest program you can
// you can write in Java
// Print “Hello World” to the console
System.out.println(“Hello World”);
}
}
30-Apr-17
Air Force Institute of Technology
Electrical and Computer Engineering
5
Object-Oriented
Programming
Design
Java Programming Environment
• Compiling the program
javac HelloWorld.java
• Running the program
java HelloWorld
• CLASSPATH environment variable
– Do not define it unless you know what you are doing
– If you do define it, ensure you include a period:
set CLASSPATH=.;c:\java;
30-Apr-17
Air Force Institute of Technology
Electrical and Computer Engineering
6