Java - compiling?!

i typed out the code in dos, saved as a .java file.... then im asked to compile it by adding:

C:/DIRECTORY>javac First.java

where do i compile it?!!

Rabid Dog

Web Master

Posts: 3245

Loc: South Africa

3+ Months Ago

It will compile it to the directory it is located in

someone showed me a really cool trick for the command prompt

type the name of the executable then a sapce then /?
ie javac /?

it will show all the possible switches and parameters for the javac file

Nem

Guru

Posts: 1243

Loc: UK

3+ Months Ago

so: myfirstjavaprog.java ?/

Rabid Dog

Web Master

Posts: 3245

Loc: South Africa

3+ Months Ago

no just type in javac /?

if your environmental variables are set correctly then it will recognise it otherwise you may have to go to the directory where you installed your java sdk and then into the bin directory to execute the javac file.

the call to javac is telling the java compiler to build or compile your java file so the run time environment can understand it

TheGuy531

Born

Posts: 2

3+ Months Ago

ewww, programming in Dos? why?
Get jcreator, its an amazing java compiler, and free too.

Rabid Dog

Web Master

Posts: 3245

Loc: South Africa

3+ Months Ago

No not programming in DOS. Compiling in DOS.

Or you could get an IDE like mentioned above but I like to take the hard route when learning a new language because you tend to learn more and are not reliant on any IDE's. So should you ever have to do any debugging on a machine that doesn't have the IDE you can find a way round it - after all every windows machine has a command prompt!

Thanks for that info though - I will go check it out

Nem

Guru

Posts: 1243

Loc: UK

3+ Months Ago

agreed with rabid, thats what i been doing with php and not with java.