# Java

&#x20;[![](https://raw.githubusercontent.com/bluzelle/api/master/source/images/Bluzelle%20-%20Logo%20-%20Big%20-%20Colour.png)](https://bluzelle.com/)

**blzjava** is a Java/Android library that can be used to access the Bluzelle database service.

* Build and API [docs](https://github.com/bluzelle/docs.bluzelle.com/tree/9d6e9030f30ff5cb68247d1b3ca53cd1d224e165/blzjava/src/com/bluzelle/README.md)
* Java [docs](https://aqoleg.github.io/blzjava)
* [Examples](https://github.com/bluzelle/docs.bluzelle.com/tree/9d6e9030f30ff5cb68247d1b3ca53cd1d224e165/blzjava/examples/README.md)
* Android [example](https://github.com/bluzelle/docs.bluzelle.com/tree/9d6e9030f30ff5cb68247d1b3ca53cd1d224e165/blzjava/android/README.md)
* [Tests](https://github.com/bluzelle/docs.bluzelle.com/tree/9d6e9030f30ff5cb68247d1b3ca53cd1d224e165/blzjava/test/com/bluzelle/README.md)

## Quickstart

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](https://github.com/bluzelle/blzjava/releases) or using terminal.

```
$ wget https://github.com/bluzelle/blzjava/releases/download/0.0.1/bluzelle.jar
```

Create file "Quickstart.java".

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.bluzelle.com/developers/bluzeller2/deploy-your-dapps/blzjava.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
