70 likes | 246 Views
Object-Oriented Programming Design Topic 1: The Java Environment. Maj Joel Young Joel.Young@afit.edu. Maj Joel Young. The Java Environment. Java Compiler. JVM. Java Code. Byte Code. CPU. Java code is compiled to an intermediate form called “bytecode”
E N D
Air Force Institute of Technology Electrical and Computer Engineering Object-Oriented Programming DesignTopic 1: The Java Environment Maj Joel Young Joel.Young@afit.edu Maj Joel Young
The Java Environment Java Compiler JVM Java Code Byte Code CPU • 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
The Java Environment JVM Byte Code CPU • 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
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)
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”); } }
Java Programming Environment • Compiling the programjavac HelloWorld.java • Running the programjava 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;