blzjava is a Java/Android library that can be used to access the Bluzelle database service.
Make sure that Java is installed and has a version at least 8 (JDK 1.8).
$ java -version
$ javac -version
If Java is not installed, install it.
$ sudo apt-get update
$ sudo apt-get install default-jdk
Download bluzelle.jar from releases or using terminal.
$ wget https://github.com/bluzelle/blzjava/releases/download/0.0.1/bluzelle.jar
Create file "Quickstart.java".
import com.bluzelle.*;
public class Quickstart {
public static void main(String[] args) {
Bluzelle bluzelle = Bluzelle.connect(
"around buzz diagram captain obtain detail salon mango muffin brother morning jeans display attend knife carry green dwarf vendor hungry fan route pumpkin car",
"http://dev.testnet.public.bluzelle.com:1317",
null,
null
);
GasInfo gasInfo = new GasInfo(10, 0, 0);
LeaseInfo leaseInfo = new LeaseInfo(1, 0, 0, 0);
bluzelle.create("key", "value", gasInfo, leaseInfo);
System.out.println("created");
bluzelle.update("key", "new value", gasInfo, leaseInfo);
System.out.println("updated");
System.out.println("'key': " + bluzelle.read("key", false));
bluzelle.delete("key", gasInfo);
System.out.println("deleted");
}
}
Compile.
$ javac -cp ./bluzelle.jar Quickstart.java
Run.
$ java -cp .:./bluzelle.jar Quickstart