I am trying to create wrapper class for my smart contract using standard command

web3j truffle generate build\contracts\PKCoin.json -o src\main\java\ -p com.example.polygontestapp

but keep getting error

Unmatched arguments from index 2: 'build\contracts\PKCoin.json', '-o', 'src\main\java\', '-p', 'com.example.polygontestapp'
Did you mean: tests or truffle or solidity?

if i replace places for generate and truffle in command then i get another error

Missing required option '--truffle-json=<jsonFileLocation>'

so whatever i do i get some error, I am using web3j cli 1.4.1 version and web3j 4.8.9 version before that i was using version 3.6.0 and it worked fine but i had to update version, my platform is android EDIT: screenshot of my project structure in android studio: enter image description here

1 Answer 1


ok syntax is changed and nowhere in the documentation is it stated,so the new sintax is

web3j generate truffle --truffle-json path/to/yourJson.json --outputDir path/where/to/generate -p com.example.dapp

so in my case it would be like this

web3j generate truffle  --truffle-json build\contracts\NFTMarketPlace.json --outputDir src\main\java\ -p com.example.polygontestapp

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.