Getting Java Working

Report
Setting Up Java
CS0007: Introduction to Computer Programming
Things you will need
 You must have:
 The Java Runtime Environment (JRE)
 Includes Java Virtual Machine (JVM)
 The Java Developer Kit (JDK)
 Includes the Java Compiler
 A text editor
 Optional:
 An Integrated Development Environment (IDE) – a software
application that provides comprehensive facilities to computer
programmers for software development
 Netbeans
 Eclipse
The Java Developer Kit
 When you install the JDK, you automatically get the JRE
 It can be downloaded here:
 http://www.oracle.com/technetwork/java/javase/downloads/jdk6u25-download-346242.html
 If you want more development features you can download them
here:
 http://www.oracle.com/technetwork/java/javase/downloads/index.ht
ml
 Your best bet is to follow the directions here:’
 http://java.sun.com/new2java/programming/learn/
Text Editors
 You can create Java programs with mostly any text editors
 Windows:
 PSPad
 Notepad++
 Linux:
 gedit
 Unix/Linux:
 emacs
 vim
 nano
 Remember to save you java source file as a .java file
Compiling and Running From
Command Line
 You can compile a java source file from either a Windows or Unix
command prompt with the following command:
javac YourProgramName.java
 This will create a file called “YourProgramName.class”.
This contains the Java Byte Code for your program.
 You can run a java program from either a Windows or Unix
command prompt with the following command:
java YourProgramName
 Notes:
 Your source file should end in “.java”
 When you run your Java program just use the name of your source
file WITHOUT “.java”
The Command Line
 Basic Unix Commands:
 ../ - up one in the directory heirarchy
 ls (optional path) – list the files in the directory given in the optional
path, if no path is given, list the files in the current directory.
 cd (optional path) – go to the directory given in the optional path, if
no path is given, go to the home directory
 Many, many, many more:
 http://www.rain.org/~mkummel/unix.html
 Windows Command Line Commands:
 Same for the above, but instead of ls, use dir
 Also many, many, many more:
 http://ss64.com/nt/
Integrated Development Environment
(IDE)
 Using a text editor and compiling from the command line is the
most basic way of creating a Java program, but there are tools
available to make it easier to create Java programs called IDEs
 The two major ones are:
 Netbeans
 Eclipse
 Netbeans is an IDE from Oracle, the current owners of the Java
language, and thus, is very easy to use with Java.
 If you install Netbeans, it will guide you through installing the JDK
 Eclipse is a third-party open-source IDE that is very powerful and
popular.
 You may need to install the JDK successfully before installing Eclipse.
Netbeans and Eclipse Demo

similar documents