0

I am interested in interacting with a smart contract via a Java application. I found that there is a library called web3j (https://docs.web3j.io/) for which this should be possible, however there is not much documentation on how to install it. I expect that I should import Web3j with "import Web3j", but first I would have to install the package from the downloaded Git repository. In the documentation it just says "Add the latest web3j version to your project build configuration.", and then mentions "Maven" and "Gradle", but I have never heard about these before. Can't I just link the files to my project in eclipse without using some third party programs? So, to summarize, my question is:

How do I easiest link Web3j so I can import it into a java project in eclipse?

1 Answer 1

2

This is more a Java question than a question related to Ethereum or web3j.

If you are not familiar with Maven or Gradle, I highly recommend reading into them. Almost every Java project uses them.

As a quickstart: To create a Maven project in Eclipse, click on "File -> New -> Project". You will see the following dialog, select "Maven Project".

Create a maven project

After doing this, you add the web3j dependency to the project file (pom.xml):

<dependencies> 
    <dependency> 
        <groupId>org.web3j</groupId>  
        <artifactId>core</artifactId>  
        <version>3.1.1</version> 
    </dependency>  
</dependencies>  

You are now able to use the imports by web3j in your code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.