0

I followed these steps to install Vert.x on my machine.

  • Intall OpenJDK : sudo apt-get install openjdk-8-jdk
  • Test java installation: java -version which is giving me 3 outputs:

    1. openjdk version "1.8.0_242"
    2. OpenJDK Runtime Environment (build 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08)
    3. OpenJDK 64-Bit Server VM (build 25.242-b08, mixed mode)
  • Download latest version of Vert.x at https://vertx.io/

  • Untar the downloaded file: tar xzvf vert.x-3.8.5-full.tar.gz
  • Make vertx executable: chmod +x vertx/bin/vertx
  • Go in the bin folder: cd vertx/bin
  • Test Vert.x version: ./vertx version which is giving me 3.8.5 as output

I then created a .java file with the following code in it:

import io.vertx.core.AbstractVerticle;
import io.vertx.core.eventbus.EventBus;

public class Producteur extends AbstractVerticle 
{
    public void start() throws Exception
    {
        System.out.println("> Launching...");

        final EventBus eb = vertx.eventBus();

        vertx.setPeriodic(1000, v -> {

            eb.send("canal-ptp", "Hello", reply -> {

                if(reply.succeeded())
                    System.out.println("> Response received : " + reply.result().body());
                else
                    System.out.println("> No response!");
            });
        });
    }
}

This code is working fine when launch with the following command is a terminal:

./vertx run Producteur.java --cluster

But when I add the following import at the beginning of the java file:

import io.vertx.core.json;

I get the following error:

error: cannot find symbol import io.vertx.core.json

What am I missing? I don't get why the other imports are fine, but this one isn't. In the end, I'd like to replace the "Hello" string with a json object.

Please note that I'm a complete noob with ubuntu/java/vertx overall. Thanks!

1 Answer 1

1
import io.vertx.core.json;

is not a module you can import.

import io.vertx.core.json.JsonObject;

is.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .