# problem with writing java in textpad



## dav2b3 (Nov 25, 2004)

i am taking a java course in school and i wanted to try it at home so i downloaded texpad since thats what i use in school. i did a very very basic program:
class Prog1
{
public static void main(string args[])
{
System.out.println("Nerds rule");
}	// end of method main
}	//end of class Prog1

and i get message saying "E:\WINDOWS\system32\javac.exe" in the tab and in the window it says "The system cannot findthe file specified." i want to try the good stuff and i cant do the basics. can anyone help?


----------



## LoneWolf071 (Nov 10, 2004)

you need to save it as javac.exe, cause you need to save it as javac.java then compile it into a .class file


----------



## dav2b3 (Nov 25, 2004)

i saved it as an .exe but dont know what to do now.


----------



## LoneWolf071 (Nov 10, 2004)

sorry, my bad, don't save it as javac.exe, but as javac.java


----------



## impact (Nov 7, 2005)

Depending on how I interpret your question, there are a few possibilities. First of all, "javac ThisIsMyProgram.java" will not compile if (1) your sourcecode does not have the ending .java and (2) your computer does not recognize the "javac" command.

I am assuming that your computer cannot recognize the javac command. There are a few creative ways to make it do so. On Windows, because I'm a lazy programmer, I just use a bat file.

For instance . . .

javac.bat might have

c:\\java\bin\javac.exe %1 %2 %3 %4 %5 %6 %7 %8

The %1 for instance would pass your first argument on the command line after "javac" to the actual "javac.exe" on your system. You can place javac.bat in your current working directory, which is what I normally do. But it can go in any path that your system routinely checks when it is initializing.

Alternatively, if you enjoy living dangerously, you can extend the CLASSPATH in your autoexec.bat. This is assuming your computer runs the autoexec.bat when it starts up.

If you have a JRE installed on your computer, the command "java ThisIsMyProgram" would work once it is compiled into ThisIsMyProgram.class. If you only have a JDK, it "might" be necessary repeat what I described for "javac" but this time using "java".

Getting over this initial hurdle is probably the most irritating phase for most new Java programmers.


----------

