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

Mobile Terms & Acronyms

"Wireless technology continues to evolve at a rapid pace and along with it so too does the language used by the wireless industry - which at times can leave even the most accomplished wireless practitioner confused or bemused" 1G The first generation of analogue mobile phone technologies including AMPS, TACS and NMT 2G The second generation of digital mobile phone technologies including GSM, CDMA IS-95 and D-AMPS IS-136 2.5G The enhancement of GSM which includes technologies such as GPRS 3G The third generation of mobile phone technologies covered by the ITU IMT-2000 family 3GPP The 3rd Generation Partnership Project, a grouping of international standards bodies, operators and vendors with the responsibility of standardising the WCDMA based members of the IMT-2000 family 3GPP2 The counterpart of 3GPP with responsibility for standardising the CDMA2000-based members of the IMT-2000 family. 3GPP2 is spearheaded by ANSI 8PSKOctantal Phase Shift Keying A5/1/2/3/8X Encryption algor...

Windows 7 gets you what you expected!

Windows 7 , the next client release of Microsoft will be available in 32 & 64-bit versions. Here are some things that you asked for in your Desktop OS: For end –users 1. Faster - Your system starts up, shuts down and resumes from standby faster, and your laptop’s battery lasts longer! 2. Touch - Multi touch, ink and gesture support along with handwriting recognition allow you to create exciting new input capabilities. Managing large number of windows is much easier, with intuitive touch gestures to view multiple windows at once and remove unwanted windows. 3. Faster Browsing - Build for the web with IE8 , add rich media with Silver light and extend to rich client with WPF – using the same platform and tools 4. Explore and Share - With Windows 7 and Windows Live , you can easily manage your documents, pictures, movies and music, regardless of which PC they are stored on, and share them with your friends and family. 5. Search - Win...