• Sales: 1-800-961-2888
  • Support: 1-800-961-4454

Java API Installation


Contents

Overview

In this tutorial we will cover installing the Cloud Files Java API For Both Windows and *nix (this should be the same for MacOSX). We assume you have Apache Ant installed and configured on your machine and the Java Run Time and JDK.

What we need

Windows Install

  • Head to our Github.
  • Select Download. I would recommend saving this file onto your Desktop.
  • Go ahead and unpack the API onto your desktop.
  • Open Command prompt and head to your Desktop you should have a file like this: rackspace-java-cloudfiles-db47ab8e43ed0b291c4384b351e1edb8cbb394c8
  • cd into that directory and run this command
ant compile

If it says build successful You should have everything you need.

*nix Installation

  • Head to our Github.
  • Select Download. I would recommend saving this file onto your Desktop.
  • Go ahead and unpack the API onto your desktop using this command.
cd ~/Desktop

Then

tar zxvf rackspace-java-cloudfiles-db47ab8e43ed0b291c4384b351e1edb8cbb394c8.tar.gz
  • Then cd into the rackspace-java-cloudfiles-db47ab8e43ed0b291c4384b351e1edb8cbb394c8 directory then run this command:
ant compile

If it says build successful You should have everything you need.

Check our work

Now we will write a simple script to test jar we just made. Here is the code

import com.rackspacecloud.client.cloudfiles.*;
public class Test
 {
  public static void main (String  args[])
   {
   }
 }

Please note that you save the file as Test.java or you will throw a compilation error.

Once you have created and saved this script to your desktop run this command:

For Windows:

javac -classpath "C:\Documents and Settings\JimBob\Desktop\java-cloudfiles\dist\java-cloudfiles.jar" Test.java

For Linux:

javac -classpath /home/JimBob/Desktop/java-cloudfiles/dist/java-cloudfiles.jar  Test.java

If everything compiles ok the package was created correctly.

If you get an error like this:

Test.java:1: package com.rackspacecloud.client.cloudfiles does not exist
import com.rackspacecloud.client.cloudfiles.*;
^
1 error

Then you are not specifying the correct path. Remember the paths provided in the commands above need to be replaced with the correct path to the jar file for your machine. If you have anymore questions or comments please feel free to shoot us an email at cloudfiles@rackspacecloud.com



© 2011-2013 Rackspace US, Inc.

Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License


See license specifics and DISCLAIMER

4 Comments

Do you have a maven plugin for this API?
Thanks!!

I don't think we do. If one were created it would likely be added to our github repository: https://github.com/rackspace/

wow, Ive never seen an api insisting on crapping up every project that uses it like this one. Consider making this more self contained and doing away with all the extra junk. bare-bones would be SO much better.

I fear this is often going to be the case. Most software has dependencies. This is solved in the Java world with Maven (or Gradle or what-have-you). If you really well and truly only want the Cloud Files portion of the Java SDK you can add the following to your Maven pom.xml file:

<dependencies>
<dependency>
<groupId>org.jclouds.provider</groupId>
<artifactId>cloudfiles-us</artifactId>
<version>1.5.5</version>
</dependency>
</dependencies>

That will bring in the minimum number of dependencies to work with Cloud Files US (use artifactId cloudfiles-uk for Cloud Files UK).

Add new comment