在web3j中创建钱包时如何解决异常?

时间:2019-01-21 10:28:00

标签: ethereum truffle geth web3-java

C:\ Users \ 1636820 \ Downloads \ web3j-3.4.0 \ web3j-3.4.0 \ bin>创建web3j钱包

             _      _____ _     _
            | |    |____ (_)   (_)
__      _____| |__      / /_     _   ___
 \ /\ / / _ \ '_ \     \ \ |   | | / _ \
 \ V  V /  __/ |_) |.___/ / | _ | || (_) |
  \_/\_/ \___|_.__/ \____/| |(_)|_| \___/
                         _/ |
                         |__/

Please enter a wallet file password:
 re-enter the password:
Please enter a destination directory location 
[C:\Users\1636820\AppData\Roaming\Ethereum\testnet\keystore]: 
C:\Users\1636820\Downloads\web3j-3.4.0\web3j-3.4.0\bin
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
    at org.bouncycastle.util.Arrays.clone(Unknown Source)
    at org.bouncycastle.crypto.generators.SCrypt.SMix(Unknown Source)
    at org.bouncycastle.crypto.generators.SCrypt.MFcrypt(Unknown Source)
    at org.bouncycastle.crypto.generators.SCrypt.generate(Unknown Source)
    at org.web3j.crypto.Wallet.generateDerivedScryptKey(Wallet.java:132)
    at org.web3j.crypto.Wallet.create(Wallet.java:70)
    at org.web3j.crypto.Wallet.createStandard(Wallet.java:89)
    at org.web3j.crypto.WalletUtils.generateWalletFile(WalletUtils.java:65)
    at 
org.web3j.crypto.WalletUtils.generateNewWalletFile(WalletUtils.java:56)
    at 
org.web3j.crypto.WalletUtils.generateFullNewWalletFile(WalletUtils.java:40)
    at org.web3j.console.WalletCreator.run(WalletCreator.java:39)
    at org.web3j.console.WalletCreator.main(WalletCreator.java:26)
    at org.web3j.console.WalletRunner.main(WalletRunner.java:23)
    at org.web3j.console.WalletRunner.run(WalletRunner.java:14)
    at org.web3j.console.Runner.main(Runner.java:35)

C:\ Users \ 1636820 \ Downloads \ web3j-3.4.0 \ web3j-3.4.0 \ bin>

如何解决此问题以及在哪里保存钱包文件?

1 个答案:

答案 0 :(得分:0)

问题就在这里,除了:

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
  

在32位系统上,您可以增加到4GB。如果您使用的是64位系统,则可以更高。不用担心您选择错误,如果您在32位系统上要求5g,则Java会抱怨值无效并退出。

     

如其他人所发布的,请使用cmd-line标志-例如

     

java -Xmx6g myprogram   您可以通过键入java -X来获得完整列表(或者无论如何都接近完整列表)。

来源:https://stackoverflow.com/a/1566026/3374428


您可以尝试使用以下替代解决方案:https://lhalcyon.com/blockchain-eth-unlock-android/