Ana səhifə

How to Set Up Eclipse in 3 easy steps…and a couple more


Yüklə 8.96 Kb.
tarix09.06.2016
ölçüsü8.96 Kb.
How to Set Up Eclipse in 3 easy steps…and a couple more.

(For CS 2110 by Greg Akselrod (gba4@cornell.edu), but feel free to share with your friends)




Eclipse is a powerful and well adopted Java IDE (Integrated Development Environment). There are other good ones, but Eclipse seems to be the most widely used at Cornell.
Disclaimer: These instructions are for Windows. Everyone tells me Macs are really easy to use, so you Mac’ers probably don’t need instructions anyway =þ And if you’re using Linux, then you’re just too cool for school.
Download and Install Eclipse

  1. Download Eclipse IDE for Java Developers from http://www.eclipse.org/downloads

  2. Extract it with your favorite unzip program to c:\ (or wherever you like best)

    1. It should create a folder called “eclipse” in c:\

Download and Install Java Developers Kit (JDK)



  1. Download “JDK 6 Update 11” from http://java.sun.com/javase/downloads. Install it leaving all the defaults.

    1. Note: Be careful not to install the one above it called “JRE”. JRE is the Java Runtime Engine, which can run Java programs but can’t compile them. The JRE is included with the JDK (so you can run the programs you compile – duh  )


Add Java to your system path

  1. Find where your JDK is installed

    1. Probably something like c:\program files\java\jdk1.6.0_11

    2. If there are multiple jdk’s, use the one with the highest version number

  2. Control panel -> System -> Advanced (tab) -> Environment Variables

    1. You’ll see two select boxes. In the bottom one (with the heading System variables) scroll until you see the Path variable. Highlight it and click Edit

    2. In the box labeled “Variable value” there is a looooong string which might look something like:

      %systemroot%\system32;%systemroot%;blah;blah;

      Get to the end of this long string beyond what might be visible (put the cursor in the box and hit the End key or arrow all the way to the right), make sure there is a semicolon ( ; ) at the end and add the path to the “bin” directory inside of your JDK installation, so it will look like:

%systemroot%\system32;%systemroot%;blah;blah;c:\program files\java\jdk1.6.0_11\bin


Careful: Make sure you have \bin at the end, and make sure that the jdk directory you specify is actually where Java got installed to on YOUR computer (it can vary)

    1. To check if it worked, go to start->run and type “cmd”. Hit enter.

      1. A command prompt should open up with a blinking cursor. Type “java” and hit enter. If it gives you a bunch (more than 2) of lines of output, it worked. Try “javac” too.


That’s it, you’re set! You can launch Eclipse from c:\eclipse\eclipse.exe

(Turn over for instructions for creating your first project in Eclipse)



  1. The first time you launch Eclipse, it will ask you where you want to save your workspace. The default should be fine. This is where it will save all your source code.

  2. A project in Eclipse is basically a program. You’ll want to create a new project for each program you write (so for assignment 1, you’ll have 2).

  3. Go to File->New->Java Project

    1. Name your Project. Something like “Bank” or “My First Project”

    2. Under “Project Layout”, select “Use project folder as root for sources and class files”. This isn’t absolutely necessary, but makes it easier when you’re trying to read and write files from your Java program.

    3. Leave the rest as the default. Click Next, then click Finish.

  4. On the left under Package Explorer, expand your Project. You should see a “src” folder. Right click “src” and go to New->Class. Specify a name and hit Finish.

  5. Inside the class, type

public static void main(String[] args) {

System.out.println("Hello world!");

}


  1. To run the application, go to Run->Run (or hit Ctrl+F11). Select “Java Application”. Hit OK.

  2. If it asks you to save files, just hit OK.

  3. You should see “Hello world!” in the console box at the bottom.


Congratulations! You got all the way through this tutorial! Now take a nap, you’ve earned it.


Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©kagiz.org 2016
rəhbərliyinə müraciət