The following code compiles in Java but gives:

error: cannot find symbol import org.web3j.protocol.Web3j;

and other import related errors on runtime. I'm new to the Java environment (using VS Code) What am I missing, how can I check and fix the dependencies?

// Code to implement Infura using web3j:

package org.web3j.protocol.infura;
import org.web3j.protocol.Web3j;
import java.io.IOException;
import org.web3j.protocol.http.HttpService;
import org.web3j.protocol.core.methods.response.Web3ClientVersion;

public class web3jsTest {

public static void main(String args[]) throws IOException {

    Web3j web3 = Web3j.build(new HttpService("https://rinkeby.infura.io/<token>"));
    Web3ClientVersion web3ClientVersion = web3.web3ClientVersion().send();
  • edit i opened a new question with this problem i got a similar problem here with a jar on ubuntu 18.04. web3j is globally installed with homebrew, PATH is set for web3j. package de.cweitzel.carob; import de.cweitzel.wrapper.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.web3j.crypto.Credentials; import org.web3j.crypto.WalletUtils; import org.web3j.protocol.Web3j; import org.web3j.protocol.core.methods.response.TransactionReceipt; import org.web3j.protocol.http.HttpService; import org.web3j.tx.Contract; import org.web3j.tx.ManagedTransaction; import org.web3j.tx.Trans – NosWiz Sep 21 '18 at 9:42

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.