How to do JAVA programs on Windows??

1.You have to download latest version of JDK.

  • Download for windows 32 bit  here.
  • Download for windows 64 bit here.

2.Install it in your computer. By default it will be  installed in the C:\Program files\java.

3.Now you have to set the Environment variable.

4.How to set the Environment variable.??

  • First of all , go to C:\program files>java>jdk_xxx>bin. . It will be like C:\Program Files \Java\jdk1.7.0_04\bin. Copy that location.Screen shot is below
  • Go to environment variables.Start>right click on Computer>properties>Advanced System variables>Environment variable.
  • In user variable press New. Screen shot as below.
  • Set the variable name as PATH.
  • Paste the location of java which have copied in the previous step in variable value field.Press ok.
  • You are done with the setting up of environment variables.
  • now you can do java programs as below.

5.Open any text editor , write simple java code.Save it with .java extension.

6.Start> In search box type cmd>press enter.

7.Command prompt will open.Go to directory where your program is stored.

Eg: If you have saved your program on desktop use the command >cd Dektop.

8.Confirm that you are in the correct directory by using the command >dir. It will show the all files and directories in that  directory.If you can see your .java file , you are in correct directory.

9.Compile it using the command >javac  . Here is name of my java file.If errors occure edit the code in the text editor , save it again, compile it again.Compile the code untill you do not get the errors.

10.Now You can Execute by using >java hello .

10.You can observe the ouput.!!

How to execute java servlet programs!!

1.First you have to install Tomcat server. Know how install here!

2.Go to the directory where the tomcat installed On my computer it is installed at C:\Program Files (x86)\Apache Software Foundation\Tomcat 6.0.

3.From there go to >lib directory. Copy the location.In lib directory you can observe a file calles servlet-api.jar. Screen shot is as below
4.Go to Environment variables , now press New in system variable( not user variable). Screen shot is as below.5.Set variable name as CLASSPATH, and paste the location copied before i.e C:\Program Files (x86)\Apache Software Foundation\Tomcat 6.0\lib and add at the end \servlet-api.jar  .

6.So the location becomes C:\Program Files (x86)\Apache Software Foundation\Tomcat 6.0\lib\servlet-api.jar.  Add .; at beginng.

7.All together it will look like         .; C:\Program Files (x86)\Apache Software Foundation\Tomcat 6.0\lib\servlet-api.jar 

8.Press ok.Now you can execute your java servlet programs as normal java programs and You can use the .class file in tomcat server.

This entry was posted in tech it !!. Bookmark the permalink.

One Response to How to do JAVA programs on Windows??

  1. Pingback: How to do java servlet programs using tomcat!! | thegeekuday

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s