nekojan
Posts: 2
Joined: Mon Feb 20, 2017 9:48 pm

How to install dependencies and run class in Pi?

Mon Feb 20, 2017 11:29 pm

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.

texy
Forum Moderator
Forum Moderator
Posts: 5160
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

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

Tue Feb 21, 2017 7:39 am

Register and log in to that website and you can ask questions in the comments section at the bottom of the page....

Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

User avatar
B.Goode
Posts: 10725
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

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

Tue Feb 21, 2017 8:14 am

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

nekojan
Posts: 2
Joined: Mon Feb 20, 2017 9:48 pm

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

Tue Feb 21, 2017 8:19 pm

Ok. Thanks for the tips.
Should we close/delete the topic then?

texy
Forum Moderator
Forum Moderator
Posts: 5160
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

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

Wed Feb 22, 2017 8:29 am

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
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

User avatar
clicky
Posts: 501
Joined: Thu Oct 25, 2012 7:34 am

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

Wed Feb 22, 2017 3:33 pm

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...

Return to “Java”