Title: Cmd Line Development Environment
Course: CPS 261: Advanced Java Concepts ~ DL & MM MASTER

Command Line Development Environment



Running your Java development tools outside of Eclipse

Run the command(DOS) tool from the Start_Button/Accessories. Note the directory that prints out as the current working directory when you start this tool up.

Find out the "bin" directory of your Java development tools ... it should be something like: c:\Program Files (x86)\Java\jdk1.7.0_05\bin

Issue a path command to tell the DOS environment where to find your Java tools. This command should basically add the Java bin directory to the front of the normal path used in the DOS command. tool. The command should look something like:
path=c:\Program Files (x86)\Java\jdk1.7.0_05\bin;%path%

If you have the path command correctly, you should be able to issue the Compiler command which will print out your compiler options:
javac

Next you will want to add a Java program to test out. You can use notepad to put this program in the current working directory where your DOS command tool is running. You can try out the following program:


import java.util.Scanner;

class Hello
{
   public static void main(String[] args)
   {
       System.out.println("hello world ... Enter your name");

       Scanner keyboard = new Scanner(System.in);
       String input = keyboard.nextLine();
       System.out.println("Hello: " + input);

   }
}


To compile the program, issue the command:
javac Hello.java

To execute the program, issue the command:
java Hello

To see the executable output of the compiler (Hello.class), issue the DOS command:
dir

Exercises:

- Use the above notes to install the latest Java JDK and run a simple program
- Install Eclipse and run a simple program
- For fun: For fun, download the following program created by one of my CPS261 students ... This needs some explaination and a demo:
planetoid.jar
From your command line issue the command:
java -jar planetoid.jar

Last Modified: November 7, 2013 9:10 AM