简体   繁体   English

Web3j Solidity 生成命令不起作用

[英]Web3j Solidity Generate Command Not Working

I believe I have everything set up correctly as other Web3j and solc commands have been working fine.我相信我已经正确设置了所有内容,因为其他 Web3j 和 solc 命令工作正常。 However, Following the instructions here: https://docs.web3j.io/smart_contracts.html#deploying-and-interacting-with-smart-contracts to create the autogenerated java wrapper has not been working, when I run the last command it shows me the syntax instead of creating the java code.但是,按照这里的说明: https : //docs.web3j.io/smart_contracts.html#deploying-and-interacting-with-smart-contracts创建自动生成的 java 包装器一直没有工作,当我运行最后一个命令时向我展示了语法而不是创建 java 代码。 I ommitted the web3j picture text.我省略了 web3j 图片文本。

>$ ls
>registrar  registrar.sol

>$ solc registrar.sol --bin --abi --optimize -o ./registrar/

>$ ls registrar  
Registrar_Contract.abi  Registrar_Contract.bin

>$ web3j solidity generate ./registrar/Registrar_Contract.bin ./registrar/Registrar_Contract.abi -o ./

and I get this response instead of it generating file:我得到这个响应而不是它生成文件:

solidity generate <input binary file>.bin <input abi file>.abi [-p|--package  <base package name>] -o|--output <destination base directory>

I have tested this a decent amount and have not had any success.我已经对此进行了大量测试,但没有取得任何成功。 Any help would be greatly appreciated.任何帮助将不胜感激。

PS I am on Mac OS Sierra and used homebrew to install everything, the only command that didn't work during installation was "brew linkapps solidity" from http://solidity.readthedocs.io/en/develop/installing-solidity.html#binary-packages but I continued because solidity commands were working anyways. PS我在Mac OS Sierra上使用自制软件来安装所有东西,唯一在安装过程中不起作用的命令是来自http://solidity.readthedocs.io/en/develop/installing-solidity.html的“brew linkapps solidity” #binary-packages但我继续,因为 Solidity 命令无论如何都在工作。

您缺少参数,请尝试以下命令:

web3j solidity generate /registrar/Registrar_Contract.bin ./registrar/Registrar_Contract.abi -o /path/to/yourSrc/main/java -p your.application.id

使用以下命令进行修复

web3j solidity generate -b Practice.bin  -a Practice.abi -o D:\Solidity\sample-project-gradle-master\src\main\java  -p org.web3j.sample

使用以下命令:-

web3j generate solidity -a ./registrar/Registrar_Contract.abi -b ./registrar/Registrar_Contract.bin -o /path/to/yourSrc/main/java -p package.name

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM