Sunday, 2 February 2014

How to Run a Java Program without using any IDE

hello friends ,

I am here to explain how to run a java program on your system. It is very simple .


 write a java program and save it with ".java" extension.

for example :

class A
{
             public static void main(String[] args)
            {
                    System.out.println("Hello World !!");
            }

}


Your JDK ( Java Development Kit ) version may differ from mine but it does not matter so much for beginners .If you don't have installed JDK on your machine yet you can download latest JDK from this official link of Oracle "download latest JDK Version " and install it at default directory , after installation a java directory will be created in C drive under program files.

Now you can save above given program as "A.java" . beginners can simply save the program at location "C:\Program files\Java\jdk1.7.0_51\bin".

Now goto command prompt and reach to the location where file is saved . for reaching you can simply type "cd C:\Program files\Java\jdk1.7.0_51\bin" as :


now press enter.

and type the command "javac A.java" and press enter for compilation and then type command "java A" for running the program.

Output window will appear like this ::


Thank You :)



Thursday, 23 January 2014

How to run a jsp program

For run a jsp program you will need a server. for example Apache Tomcat which can be download from http://tomcat.apache.org/ .

After installation you can open the home page of Apache Tomcat by typing localhost:8080 on your browser's address bar where 8080 is aloted port number to the apache tomcat server at the time of installation . Home page of apache tomcat may look like this :


If this page appears then you have installed apache tomcat server successfully  :)


sample jsp program :

<html>
  <head>
    <title>sample JSP program</title>
  </head>
  <body>
   <% out.println("Hello World"); %>
  </body>
</html>



save it as sample.jsp at the location C:\Program Files (x86)\Apache Software Foundation\Tomcat 7.0\webapps\ROOT 


Now type localhost:8080/sample.jsp/ on browser's address bar.

Output will look like this ::
Thank You :)