mirror of
https://github.com/ChristopherA/Learning-Bitcoin-from-the-Command-Line.git
synced 2025-06-07 16:06:26 +00:00
add Java installation details and reference to sample project
This commit is contained in:
parent
19703ec85c
commit
081bc6893a
@ -4,6 +4,23 @@
|
||||
|
||||
Interacting with the `bitcoind` directly and using command-line `curl` can get simple if you understand how it works, but there's a project [JavaBitcoindRpcClient](https://github.com/Polve/JavaBitcoindRpcClient) that provides the functionality in a Java-API level, making it even easier to interact with your Bitcoin Server.
|
||||
|
||||
|
||||
## Setup Java
|
||||
|
||||
To install Java on the VPS Server, you are able to use the `apt-get` command. We will also use [Apache Maven](http://maven.apache.org/) to manage the dependencies, so we will install it together.
|
||||
|
||||
```
|
||||
$ apt-get install openjdk-9-jre-headless maven
|
||||
```
|
||||
|
||||
You can verify your Java installation:
|
||||
```
|
||||
$ java -version
|
||||
openjdk version "9-internal"
|
||||
OpenJDK Runtime Environment (build 9-internal+0-2016-04-14-195246.buildd.src)
|
||||
OpenJDK 64-Bit Server VM (build 9-internal+0-2016-04-14-195246.buildd.src, mixed mode)
|
||||
```
|
||||
|
||||
## Setup Dependency
|
||||
|
||||
If you use Maven in your Java project, you can include the dependency:
|
||||
@ -20,6 +37,8 @@ Or if you use Gradle:
|
||||
compile 'wf.bitcoin:JavaBitcoindRpcClient:0.9.13'
|
||||
```
|
||||
|
||||
If you want a sample project and some instructions on how to run it on the server that we just created, you can refer to the [Bitcoind Java Sample Project](https://github.com/brunocvcunha/bitcoind-java-client-sample/).
|
||||
|
||||
### Build Your Connection
|
||||
|
||||
To use `JavaBitcoindRpcClient`, you need to create a `BitcoindRpcClient` instance. The arguments in the URL are username, password, IP address and port. You should know this information from your work with `curl` . As you'll recall, the IP address 127.0.0.1 and port 18332 should be correct for the standard testnet setup described in this documents, while you can extract the user and password from `~/.bitcoin/bitcoin.conf`.
|
||||
|
Loading…
x
Reference in New Issue
Block a user