By Sergey Skudaev
When you installed Java SDK,Tomcat or some other software you have to create environment variables in Windows 2000 or edit AUTOEXEC.BAT file in WINDOWS 95, 98, Me.
My AUTOEXEC.BAT file looks like this:
C:\j2sdk1.4.0\bin; line required to be able to compile java source file regardless of its location. For example, if you place your Java source file. In "C:\Java\hello_word" directory, then in Command prompt you will go to hello_world directory and type javac + source file name with java extension. In my example file is Hello.java. Using PATH system will find javac.exe file in bin directory and compile java source file in class file with class extension.
Hover mouse over a thumbnail to see a large image.
SET CLASSPATH=.;C:\j2sdk1.4.0\lib\classes; line points to location of java class files. Dot means that class file will be created in the same directory as source file. If system does not find class file in the same directory, then it will look in C:\j2sdk1.4.0\lib\classes directory. In my example Hello.class will be created in hello_world directory. To execute the java program you have to type java + class file name without extension. In my example it is java Hello. When program is executed Hello World is displayed on the command prompt. Below I show the Hello World source file. Note that class name is the same as file name. Public Class is Hello and file name is hello. This is not very interesting program, but you can use it to check your computer configuration. If you can compile and run the program, then everything is OK
public class Hello
public static void main(String args)
In WINDOWS 2000 you do not use AUTOEXEC.BAT file. Instead you create environment variables. On your computer desktop right click the My Computer icon and select Properties.
On Windows 7 select Start, right click Computer. Click Advance System setting on System properties window select Advance tab, Click Environment Variables button
On Windows XP, to get to the same System Properties window, select Start, Select Control panel,
In the opened Control panel select Performance and Maintenance (it is ar the bottom),
Select System, Advance tab.
Click the Environmental Variables button. Environment Variables window displays.
Click New button in System variables frame at the bottom of the Environment Variables Window. For Java SDK enter Path environment variable and.
enter path to JAVA bin folder on your PC. On mine it is C:\j2sdk1.4.0\bin. Type semicolon at the end. If you installed tomcat after java type path to tomcat bin folder on your PC. On mine it is C:\j2sdk1.4.0\bin;C:\jakarta-tomcat-4.1.29\bin;. Do not forget to type semicolon. Click OK button. Click OK button on Environment Variables window. Click OK button on Properties window.
To execute Java program create CLASSPATH environment variable.
For Tomcat enter CATALINA_HOME environment variable name and path to the folder where your tomcat installed. On mine it is C:\jakarta-tomcat-4.1.29
To run Tomcat you need to create JAVA_HOME environment variable. To check your configuration for Tomcat go to C:\jakarta-tomcat-4.1.29\bin directory, type startup and press enter.
Tomcat starts in separate command prompt window.
If Tomcat does not start, probably you have not enough memory set in command prompt. Go to command prompt menu on your desktop and right click it
From drop down menu select properties. Select memory tab. Increase convention memory and click OK to save changes.
Close command prompt if you had it open. Open again and try to start Tomcat.
Now it should be started. To make sure that Tomcat is running properly, open Internet Explored and type URL address:
Tomcat home page displays.
Click JSP or Servlet Examples link. Play with examples and have fan!