# java cmd line help



## tenniskev18 (May 11, 2007)

Hey guys! This is my second java class and in the first we didn't have to use cmd. It was like behold and then go on. lol

Anyways our TA's that grade our assignments use the cmd to check our programs. 

Well.. how can i get a program to compile in the cmd? I can get it to run.
also if i go into a directory, how can i go backwards?

Last question, what command do i use to open through cmd with applet viewer. Is it Appletviewer ?

Thanks


----------



## Chicon (Jul 29, 2004)

Hi tenniskev18,

To compile your JAVA program, you have to use the command *javac.exe*.
On a Windows standard installation, both *javac.exe* and *appletviewer.exe* files are stored in the following directory :

*C:\Program Files\Java\jdkXXX\bin* where *XXX* is the version number of the JDK.


----------



## r3drock3t88 (Jan 13, 2007)

to compile code through command line you have to navigate to the folder your code is in by using the "cd" command...for example, if I wanted to navigate to a folder named "java" that is in my C drive, I'd type this...

cd c:\java

and my command line would now be in the directory "C:\Java" ... While in there, to compile your code you type this line ...

javac nameOfFile.java

and it should compile successfully. if it doesn't that means you didnt tell your command line where java is located at on your computer. I am not 100% certain where you need to go for this because I did it awhile ago, but you can easily find help on google, unless someone here knows the directions.

If it compiles correctly, to run it type this...

java nameOfFile

And hit enter, you should be good to go!


----------

