一、安装web3j
$ brew tap web3j/web3j
$ brew install web3j
$ web3j
_ _____ _ _
| | |____ (_) (_)
__ _____| |__ / /_ _ ___
\ \ /\ / / _ \ '_ \ \ \ | | | / _ \
\ V V / __/ |_) |.___/ / | _ | || (_) |
\_/\_/ \___|_.__/ \____/| |(_)|_| \___/
_/ |
|__/
Usage: web3j version|wallet|solidity ...
二、安装solc
sudo npm install -g solc
三、生成.bin和.abi
solcjs /Users/shijun/Desktop/truffleWorkspace/eCommerce/contracts/ConfirmOrder.sol --bin --abi --optimze -o/Users/shijun/Desktop/truffleWorkspace/eCommerce_out
四、生成.java
$ web3j solidity generate --solidityTypes /Users/shijun/Desktop/truffleWorkspace/eCommerce_out/_Users_shijun_Desktop_truffleWorkspace_eCommerce_contracts_ConfirmOrder_sol_ConfirmOrderContract.bin /Users/shijun/Desktop/truffleWorkspace/eCommerce_out/_Users_shijun_Desktop_truffleWorkspace_eCommerce