Geth geth = Geth .build(new HttpService("http://localhost:8545/"));
geth.minerStart(1).send();
System.out.println("挖矿完成");
注意启动时启动参数加上miner 否则会报 method not found 错误:
geth --datadir "." --nodiscover --rpc --rpcapi "db,eth,net,web3,personal,miner" --targetgaslimit 0xffffffff console 2>>geth.log