Web3j is a Java client library that can connect to an Ethereum node. Similar to Web3 JavaScript, it can be used to interact with a smart contract on the Ethereum node. It can generate a Java smart contract from Solidity contract files.
First, let's set up the Web3j environment, as shown in the following steps:
- Install the Solidity compiler, solc, and run the following command to install it:
npm install -g solc
- Install web3j using the run brew command (at the time of writing, we used web3j-4.2.0):
brew tap web3j/web3jbrew install web3j
Once solc and web3j have been installed, you will see the following screen: