Page 1 of 1

How to install dependencies and run class in Pi?

Posted: Mon Feb 20, 2017 11:29 pm
by nekojan
Hello. I'm following tutorial on https://developer.ibm.com/recipes/tutor ... bm-watson/
and I don't know how to do the Pi set up on step 2 and step 4:
Step 1: Download the code from GitHub https://github.com/codifythings/raspber ... -assistant.

Step 2: Latest versions of Raspberry Pi comes pre-installed with Java, so you only need to download required dependencies.

Watson API – Java SDK https://github.com/watson-developer-clo ... stallation
JSON https://github.com/stleary/JSON-java
Forecast.io (you will need to register for an API key) https://github.com/dvdme/forecastio-lib ... master/jar
Step 3: Open the Constants.java file in src/com/codifythings/personalassistant folder and copy-paste credentials from Watson services that you created. You also need to change the classifier id that you saw in the final step of last section.

Step 4: Run the main class com.codifythings.personalassistant.PersonalAssistant.
How do I do step 2 and 4? I already clone the git repository in step 1 and add credentials in step 3.

Edit: I'm on pi 3, model b+. This is my 1st day with pi. So, I'm very new. Thank you for the helps.

Re: How to install dependencies and run class in Pi?

Posted: Tue Feb 21, 2017 7:39 am
by texy
Register and log in to that website and you can ask questions in the comments section at the bottom of the page....

Texy

Re: How to install dependencies and run class in Pi?

Posted: Tue Feb 21, 2017 8:14 am
by B.Goode
Welcome to the forums.

In addition to what a Moderator has already told you, I would like to add:

For future queries, if any, it is usually pretty much essential to mention what Operating System you have installed on your RPi.

Since your query relates to Java, that should be mentioned either in the thread subject/title or very early in the question. Nearly every programming language available can be used on the RPi: many of them use classes and have dependencies.

Posting your query in the dedicated Java section of these forums is another possibility.
viewforum.php?f=14

Re: How to install dependencies and run class in Pi?

Posted: Tue Feb 21, 2017 8:19 pm
by nekojan
Ok. Thanks for the tips.
Should we close/delete the topic then?

Re: How to install dependencies and run class in Pi?

Posted: Wed Feb 22, 2017 8:29 am
by texy
nekojan wrote:Ok. Thanks for the tips.
Should we close/delete the topic then?
No - if you do get the answer from here, or elsewhere, it would be useful to outline it on this thread.
Texy

Re: How to install dependencies and run class in Pi?

Posted: Wed Feb 22, 2017 3:33 pm
by clicky
Ideally you would create a maven project, add those dependencies to pom.xml, build it and then decided what to do: copy the whole project to RPi and then run it from maven or setup maven to produce 'uberjar' ('onejar' or whatever it is called), build it and copy that jar to RPi and run it there with java -jar xxx.jar

I am sure there are other alternatives (building such jar using an IDE like Eclipse, Idea, NetBeans), using gradle instead of Maven, etc...

I know I didn't directly help but hopefully, at least, given you pointers. These could be google searches (and really useful knowledge) 'how to make maven project', 'how to add dependencies to maven project', 'how to build executable jar using maven', 'how to add Watson SDK/Forecast.io/JSON to maven project',...

For instance here are some links: https://github.com/watson-developer-cloud/java-sdk, https://developer.ibm.com/recipes/tutor ... -java-sdk/, https://github.com/jinahya/executable-j ... er/pom.xml...