Hi Muhammad, Are you trying to build the riak-java-client from source? It looks like it. I guess those errors you have listed are from within eclipse. So, when maven downloads the internet, I mean the dependencies, it puts them in a special directory on your machine (your local repo). If you have not messed with your maven settings at all then your local repo is in your home directory, in a folder called .m2 ( ~/.m2/repository )
Eclipse needs to know about the location of your local repo. To tell eclipse where your repo is open eclipse preferences and chose Java -> Build Path -> Classpath Variables. If there is no variable for M2_REPO you need to create it. Hit "new" enter M2_REPO for name and chose "folder" and browse to ~/.m2/repository and hit "ok". If M2_REPO is already set just hit "Edit" and again browse to ~/.m2/repository and hit "ok". Eclipse will ask if it can do a full rebuild of your project, say yes and your problems should be over. In answer to your second question: if you run mvn those jars will be in your local repo (~/.m2/repository). Otherwise you will have to find them on their respective sites (commons http client, apache commons, commons logging, google proto bufs etc.) I recommend you use maven to get yourself started. Hope that helps Russell On 30 Mar 2011, at 18:55, Muhammad Yousaf wrote: > > Hi Russel, > > After doing the following steps. I am getting these error and tried to solve > it but i cannot > > The project cannot be built until build path errors are resolved > Unbound classpath variable: > 'M2_REPO/com/google/protobuf/protobuf-java/2.3.0/protobuf-java-2.3.0.jar' in > project 'RiakClient' RiakClient Build path Build Path > Problem > Unbound classpath variable: > 'M2_REPO/commons-codec/commons-codec/1.2/commons-codec-1.2.jar' in project > 'RiakClient' RiakClient Build path Build Path Problem > Unbound classpath variable: > 'M2_REPO/commons-httpclient/commons-httpclient/3.1/commons-httpclient-3.1.jar' > in project 'RiakClient' RiakClient Build path Build > Path Problem > Unbound classpath variable: > 'M2_REPO/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.jar' in > project 'RiakClient' RiakClient Build path Build Path > Problem > Unbound classpath variable: 'M2_REPO/junit/junit/4.4/junit-4.4.jar' in > project 'RiakClient' RiakClient Build path Build Path > Problem > Unbound classpath variable: > 'M2_REPO/org/mockito/mockito-all/1.8.0/mockito-all-1.8.0.jar' in project > 'RiakClient' RiakClient Build path Build Path Problem > > can you please tell me how can i fix them ? > > and form where i can get these following jar files ? > > riak-client-0.14.0.jar > commons-codec-1.2.jar > commons-httpclient-3.1.jar > commons-logging-1.0.4.jar > protobuf-java-2.3.0.jar > > > > Regards, > > Muhammad Yousaf > > > > > Subject: Re: Riak Java Client Error > From: russell.br...@me.com > Date: Wed, 30 Mar 2011 14:13:49 +0100 > CC: riak-users@lists.basho.com > To: muhammad.you...@live.com > > Hi Muhammad, > The riak java client depends on a couple of external libraries (eg. Apache > commons HttpClient, google protobufs). These need to be on your class path > when you run your program. The easiest way to do this is to use maven[1]. > Using maven means you can simply declare the client as a dependency of your > project and maven will take care of downloading the jar (and it's dependent > jars). If you are using an IDE (like eclipse) you can then get up and running > very quickly indeed. > > Quick start: > > 1. get maven > 2. run mvn archetype:generate > 3. edit the pom.xml (that mvn generated) and add the following to > dependencies <---- If you already have a project this is all you need to do. > > <dependency> > <groupId>com.basho.riak</groupId> > <artifactId>riak-client</artifactId> > <version>0.14.0</version> > <type>pom</type> > </dependency> > > 4. run mvn clean:install > 5 . [optional] if you have eclipse installed run mvn eclipse:eclipse to > generate project and class path files. > 6. start hacking > > Of course, if you don't want to get involved with maven you can just grab the > following jars and put them on your class path: > > riak-client-0.14.0.jar > commons-codec-1.2.jar > commons-httpclient-3.1.jar > commons-logging-1.0.4.jar > protobuf-java-2.3.0.jar > > Have a read of the README at https://github.com/basho/riak-java-client/ > > and post back here if you have any trouble. > > Cheers > > Russell > > [1] http://maven.apache.org/download.html (I recommend 2.2.1) > > On 30 Mar 2011, at 13:38, Muhammad Yousaf wrote: > > Hi, > > While playing with riak java client i am getting lots of error > > this is my code > > import com.basho.riak.client.RiakClient; > import com.basho.riak.client.RiakObject; > import com.basho.riak.client.response.FetchResponse; > > public class RiakTest { > > public static void main(String[] args) { > > // connect > RiakClient riak = new RiakClient("http://localhost:8098/riak"); > > // create object > RiakObject o = new RiakObject("mybucket", "mykey", "myvalue"); > > // store > riak.store(o); > } > } > > > getting errors like > > ./com/basho/riak/client/RiakClient.java:20: package > org.apache.commons.httpclient does not exist > import org.apache.commons.httpclient.HttpClient; > ^ > ./com/basho/riak/client/util/ClientHelper.java:21: package > org.apache.commons.codec.binary does not exist > import org.apache.commons.codec.binary.Base64; > ^ > ./com/basho/riak/client/util/ClientHelper.java:22: package > org.apache.commons.httpclient does not exist > import org.apache.commons.httpclient.HttpClient; > ^ > ./com/basho/riak/client/util/ClientHelper.java:23: package > org.apache.commons.httpclient does not exist > import org.apache.commons.httpclient.HttpMethod; > ^ > ./com/basho/riak/client/util/ClientHelper.java:24: package > org.apache.commons.httpclient.methods does not exist > import org.apache.commons.httpclient.methods.ByteArrayRequestEntity; > ^ > ./com/basho/riak/client/util/ClientHelper.java:25: package > org.apache.commons.httpclient.methods does not exist > import org.apache.commons.httpclient.methods.DeleteMethod; > ^ > ./com/basho/riak/client/util/ClientHelper.java:26: package > org.apache.commons.httpclient.methods does not exist > import org.apache.commons.httpclient.methods.GetMethod; > ^ > ./com/basho/riak/client/util/ClientHelper.java:27: package > org.apache.commons.httpclient.methods does not exist > import org.apache.commons.httpclient.methods.HeadMethod; > ^ > ./com/basho/riak/client/util/ClientHelper.java:28: package > org.apache.commons.httpclient.methods does not exist > import org.apache.commons.httpclient.methods.PostMethod; > ^ > ./com/basho/riak/client/util/ClientHelper.java:29: package > org.apache.commons.httpclient.methods does not exist > import org.apache.commons.httpclient.methods.PutMethod; > ^ > ./com/basho/riak/client/util/ClientHelper.java:30: package > org.apache.commons.httpclient.methods does not exist > import org.apache.commons.httpclient.methods.StringRequestEntity; > ^ > > > ./com/basho/riak/client/response/DefaultHttpResponse.java:20: package > org.apache.commons.httpclient does not exist > import org.apache.commons.httpclient.HttpMethod; > ^ > ./com/basho/riak/client/response/DefaultHttpResponse.java:36: cannot find > symbol > symbol : class HttpMethod > location: class com.basho.riak.client.response.DefaultHttpResponse > private HttpMethod httpMethod = null; > ^ > ./com/basho/riak/client/response/DefaultHttpResponse.java:39: cannot find > symbol > symbol : class HttpMethod > location: class com.basho.riak.client.response.DefaultHttpResponse > InputStream stream, HttpMethod httpMethod) { > ^ > ./com/basho/riak/client/response/DefaultHttpResponse.java:88: cannot find > symbol > symbol : class HttpMethod > location: class com.basho.riak.client.response.DefaultHttpResponse > public HttpMethod getHttpMethod() { > ^ > RiakTest.java:13: cannot find symbol > symbol : constructor > RiakObject(java.lang.String,java.lang.String,java.lang.String) > location: class com.basho.riak.client.RiakObject > RiakObject o = new RiakObject("mybucket", "mykey", "myvalue"); > > > > Can anyone tell what i am doing wrong ??? > > > > Regards, > > Muhammad Yousaf > > > _______________________________________________ > riak-users mailing list > riak-users@lists.basho.com > http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com > > _______________________________________________ > riak-users mailing list > riak-users@lists.basho.com > http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
_______________________________________________ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com