Skip to main content

Using Eclipse: an Introduction

r-onlineinformation.blogspot.com 

Using Eclipse: an Introduction

STARTING ECLIPSE
  1. Start eclipse by directly Biologydouble clicking the file "eclipse" inside the extracted folder (Eg. /home//Desktop/software/eclipse. This could be different and depends on where you have extracted the eclipse archive).
  2. Select the working directory to save your current project. The default directory will be /home//workspace

Start A New Project
  1. Click File->New
  2. Choose "Dynamic Web Project"
  3. Provide a name for the project
  4. Choose the option "New Runtime" and a New runtime window opens
    1. Choose "Apache Tomcat v7.0" and say Next.
    2. In the "Tomcat installation directory", browse and select "/home//Desktop/software/apache-tomcat-7.0.2"
    3. Click Finish
  5. Click Finish
Running a Hello world program in eclipse

  1. Click File-> New -> Java project -> give project name -> finish
  2. Right click on project name -> new -> class
  3. Select "Class" and say Next.
  4. Give a class name, say "HelloWorld" and say Finish.
  5. Write a main method inside the class as follows:
    • public static void main(String[] args){
      System.out.println("Hello world");
      }
  6. Save the file(Ctrl+S) and Right-click anywhere in the editor window and select Run As > Run as Java Application
  7. It runs and prints Hello world in the Console window.
Including the JDBC - PostgreSQL driver in the project build path
  1. Make sure you have the postgresql JDBC jar file. It can be downloaded from here. After downloading, copy it (Right-click, select copy).
  2. For normal Java project(simple JDBC) follow these instructions:  right click on project name -> Build Path -> configure build path-> libraries (tab)  -> Add external Jars -> browse postgresql JDBC jar file-> OK
  3. For  Dynamic Web project (Servlets) follow these instructions: In Eclipse, open Project Explorer, select the current project and browse to WebContent > WEB-INF > lib, and paste(Right-click, select paste) the copied postgresql JDBC jar file  'lib' folder.
  4. Now, create a new class and copy the contents of the sample JDBC program from here.
  5. Start your postgresql server before running this program.
  6. Update the source code with the database name, username, password etc. as described in comments in the sample program.
  7. Run as Java application(Right-Click, select Run As > Java Application). The sample program takes in a department name and prints out all its student details. Enter a valid dept_name and hit enter. It should print the output successfully.
reference: iitb.ac.in/moodle
 

Comments

Popular posts from this blog

Peer to Peer (P2P) Search Engine

r-onlineinformation.blogspot.com World Wide Web (WWW) is emerging as a source of online information at a very faster rate.It’ s content is considerably more diverse and certainly much larger than what is commonly understood. Information content in WWW is growing at a rate of 200% annually. The sheer volume of information available makes searching for specific information quite a daunting task. Search engines are efficient tools used for finding relevant information in the rapidly growing and highly dynamic web. There are quite a number of search engines available today. Every search engine consists of three major components: crawler, indexed repository and search software. The web crawler fetches web pages (documents) in a recursive manner according to a predefined importance metric for web pages. Some example metrics are back link count of the page, forward link count, location, page rank etc. The Indexer parses these pages to build an inverted index that is then used by the search s ...

Book Your Tata Nano Online

r-onlineinformation.blogspot.com Booking starts today and will close on April 25 If you are one of those many waiting to book the Tata Nano, your wait is over. You can now book the world's cheapest car by logging on to tatanano.com. The booking starts today and will last up to April 25. The website also gives you details on the price list and the booking locator. The online booking form will cost you Rs. 200, while the forms available at Titan and Tata Indicom stores will cost you Rs. 300. These forms can be submitted at Tata Motors dealerships, SBI, Croma and Westside outlets. However, the payment for the application form and booking amount cannot be paid by credit or debit cards but has to be done via netbanking from banks mentioned on the website. The website also answers FAQs like 'Will Any preference be given to the Tata Group or Tata Motors employees?' and 'How do I make the payment of booking amount in case of Online Form Submission?' So go ahead and book...

Prevent Conficker on your Windows machine

To prevent Conficker virus from infecting your Windows computer, you first need to disable the AutoRun feature. This can be done by downloading and installing certain updates manually for Windows XP or Windows 2000 . Windows Vista users can skip this step as this is taken care of via automatic updates . Now click Start , Run and enter gpedit.msc and click OK . Under Computer Configuration , expand Administrative Templates . Now for Windows XP, click System and for Windows Vista, click Windows Components then Autoplay Policies . In the Settings pane, right-click Turn off Autoplay , and then click Properties . Click Enabled , and then select All drives in the Turn off Autoplay box to disable Autorun on all drives. Click OK and restart the computer.