Sem 5‎ > ‎JAVA LAB‎ > ‎

0 Basic Setup

posted Aug 8, 2012, 10:02 AM by Neil Mathew   [ updated Aug 19, 2012, 9:58 AM ]

Bit sleepy and uninterested, so expect the content here to be messy.

First things first, you'll need to download the JDK (currently using jdk 1.6) 
and have a command prompt or a UNIX shell on your system.

Once that's done, find the location of the bin folder of your JDK folder.

C:\Java 1.6\jdk1.6.0_30\bin

C:\Program Files\Java\jdk1.6.0_30\bin

(If C Drive is restricted through My Computer, Open Run, and type c:\)

Copy this address and type the line below to direct to its folder.
cd <copied_address_pasted> 


CLS                     :    Clear Screen

CD <path>            :    Change Directory

CD..                     :    Move Back One Directory

TITLE <name>    :    Change Title of cmd window

%TIME%              :    Show Time

And as for compiling and execution, take example of a class called BiggerOf.

Javac compiles and makes a .class file in the same directory as its java equivalent.

Java executes that .class file, by default, from its source folder, ..bin/
(set the classpath to the source of the java application, and you can execute from any folder)

C:\Java 1.6\jdk1.6.0_30\bin>
    path = C:\Java 1.6\jdk1.6.0_30\bin\;

  C:\Java 1.6\jdk1.6.0_30\bin> cd src\

C:\Java 1.6\jdk1.6.0_30\bin\src> javac

C:\Java 1.6\jdk1.6.0_30\bin\src> java BiggerOf 16 2 34

Number 34 is the bigger of the three!

(Screenshot of how to copy & paste into the command prompt)