You are here: Home / Past Courses / Spring 2016 - ECPE 276 / Projects / Project 2 - Eclipse Setup

Project 2 - Eclipse Setup

Installation

  1. Download and install the latest 4.5.x "Mars" version of  Eclipse IDE for Java Developers from http://eclipse.org. Note that the "Standard" edition will not have all the required features.
  2. Download and install the latest 1.7.x version of the Java SE Development Kit (JDK) from Oracle.  Note that the JRE (Java Runtime Environment) is *not* sufficient - you actually need to be able to compile Java code.
  3. Install Eclipse add-ons
    1. Choose Help->Install New Software
    2. Choose Work with: Mars (http://download.eclipse.org/releases/mars) (assuming that you have the "Mars" version of Eclipse installed). 
    3. Check the installation box next to the following packages, enabling database access in Eclipse:

      Database Development -> Data Tools Platform Enablement Extender SDK
      Database Development -> Data Tools Platform Extender SDK

    4. Select next/finish and accept the licenses. Allow the installation to complete, and restart Eclipse.

  4. Install AWS Toolkit for Eclipse. 
    1. Choose Help->Install New Software. 
    2. Click the "Add" button next to "Work with". Enter AWS for the name and http://aws.amazon.com/eclipse/ for the location, and click OK.
    3. Check the installation box next to the following packages:
      AWS Core Management Tools
      AWS Deployment Tools
    4. Select next/finish and accept the licenses. Allow the installation to complete, and restart Eclipse.

  5. Configure AWS Toolkit
    1. Open the "Java" perspective in Eclipse
    2. Local the orange AWS button (AWS Logo) on the toolbar. Click on the dropdown arrow to the right of it, and choose "Preferences"
    3. Enter the following information for the default account.   (It might already be there if you configured the AWS CLI on this same machine and user profile)
      1. Access Key ID: <Your AWS access key ID>
      2. Secret Access Key: <Your AWS Secret Access Key>
    4. Click OK when finished

 

Demo Program 1 - AWS Overview

  1. In Eclipse, choose File->New->Project..., and then AWS -> AWS Java Project. Click Next.
  2. Enter a project name: AWS-Demo1
  3. Select the login account you previously entered for yourself.
  4. Check the box next to AWS Console Application. Click Finish.
  5. Browse the code for a bit:  Package Explorer Panel -> AWS-Demo1->src->default package->AwsConsoleApp.java. You should see demo code that performs the following actions:
    1. Prints the number of EC2 availability zones and instances running
    2. Print the number of SimpleDB tables and records contained within
    3. Print the total number of S3 buckets, and objects contained within
  6. Tip: The S3 stage of the demo might take a LONG TIME to run because of all of the files produced in our earlier project. Add this one line of code in order to see current progress:
    System.out.println("Examining bucket: " + bucket.getName());       // ADD THIS LINE INSIDE THE FOR-LOOP
    ObjectListing objects = s3.listObjects(bucket.getName()); 
  7. Finally, run the demo! Choose Run->Run.
    1. Tip: if Eclipse prompts you, you want to choose "Java Application", and then "AWSConsoleApp" (out of all of the other classes that could be run in the demo project)

 

Your output should look like this:

===========================================
Welcome to the AWS Java SDK!
===========================================
You have access to 5 Availability Zones.
You have 0 Amazon EC2 instance(s) running.
You have 0 Amazon SimpleDB domain(s)containing a total of 0 items.
Examining bucket: elasticbeanstalk-us-east-1-393047749715
Examining bucket: spotipy
Examining bucket: teststudent-bucket
Examining bucket: teststudent-common-crawl-tutorial
You have 4 Amazon S3 bucket(s), containing 1759 objects with a total size of 331861084 bytes.

 

Demo Program 2 - DynamoDB

  1. In Eclipse, choose File->New->Project..., and then AWS -> AWS Java Project. Click Next.
  2. Enter a project name: AWS-Demo2
  3. Select the login account you previously entered for yourself.
  4. Check the box next to Amazon DynamoDB Sample. Click Finish.
  5. Browse the code for a bit:  Package Explorer Panel -> AWS-Demo2->src->default package->AmazonDynamoDBSample.java.  You should see code that creates a database table and adds a few dummy records to it.
  6. Important!  We can't all use the same table name in the database!  Change the tableName variable from "my-favorite-movies-table" to something unique. Perhaps "YOURNAME-Demo2"?
  7. Finally, run the demo! Choose Run->Run.
    1. Tip: if Eclipse prompts you, you want to choose "Java Application", and then "AmazonDynamoDBSample" (out of all the other classes that could be run in the demo project)

 

Your output should look like this:

Created Table: {AttributeDefinitions: [{AttributeName: name,AttributeType: S}],TableName: Shafer-Demo2,KeySchema: [{AttributeName: name,KeyType: HASH}],TableStatus: CREATING,CreationDateTime: Sat Mar 15 23:58:36 PDT 2014,ProvisionedThroughput: {NumberOfDecreasesToday: 0,ReadCapacityUnits: 1,WriteCapacityUnits: 1},TableSizeBytes: 0,ItemCount: 0,}
Waiting for Shafer-Demo2 to become ACTIVE...
Table Description: {AttributeDefinitions: [{AttributeName: name,AttributeType: S}],TableName: Shafer-Demo2,KeySchema: [{AttributeName: name,KeyType: HASH}],TableStatus: ACTIVE,CreationDateTime: Sat Mar 15 23:58:36 PDT 2014,ProvisionedThroughput: {NumberOfDecreasesToday: 0,ReadCapacityUnits: 1,WriteCapacityUnits: 1},TableSizeBytes: 0,ItemCount: 0,}
Result: {}
Result: {}
Result: {Items: [{fans={SS: [James, Sara],}, name={S: Bill & Ted's Excellent Adventure,}, year={N: 1989,}, rating={S: ****,}}],Count: 1,ScannedCount: 2,}

 

Finally, log onto the AWS website and select the DynamoDB tool.  Then, from the top menu, select the US-West (Oregon) region, which the demo code defaulted to use for your database. You should see your table in the list, and be able to open the table and view the newly-created entries.

dynamodb-1.png

dynamodb-2.png

 

Other Demos

The SDK includes a number of other project demos that might be useful, including:

  • AmazonS3
  • AmazonS3TransferProgress (to see how fast a file upload is progressing)
  • Amazon Simple Queue Service Sample

 

References