Thursday, July 2, 2009

Executing simple application in a console window


The simple source code i wrote was stored in D:\ drive of the java directory but when you open a console window its default path is set to c:\Documents and Settings\Administrator>
in order to set it to D:\java ,you must first type d:\ and press [enter] as ilustrated in the diagram.After then type cd cd refers to "change directory". after doing that if you simply write javac app.java it will not compile it will produce error because you have not set the path of directory to the compiler of java so error willl be produced as javac is not recognised......
so you need to set the path as illustrated in the diagram
After setting the path compilation of .java file is necessary so that it can be converted into .class file so that machine can interpret it..
syntax:
Javac app.java
for execution
Syntax
java app

No comments: