How to install and use Hyperledger Fabric Java SDK in Maven, Gradle, and Eclipse
This article mainly introduces how to install and use Hyperledger Fabric Java SDK in Maven, Gradle and Eclipse, which has a certain reference value, and interested friends can refer to it. I hope you can learn a lot after reading this article.
Hyperledger Fabric Java SDK is a necessary development kit for developing Java applications based on Hyperledger Fabric block chain.
1. Use Fabric Java SDK under Maven
Add a dependency on fabric-sdk-java in the maven configuration file pom.xml:
Org.hyperledger.fabric-sdk-java fabric-sdk-java 1.4.12, use Fabric Java SDK under Gradle
Add a dependency on fabric-sdk-java in the gradle configuration file build.gradle:
Dependencies {compile group: 'org.hyperledger.fabric-sdk-java', name:' fabric-sdk-java', version: '1.4.1'} 3, use Fabric Java SDK in Eclipse
The easiest way to use Fabric Java SDK in Eclipse is to create a Maven project or a Gradle project, and then add a dependency on Farbic-sdk-java to the project configuration as described earlier.
4. Fabric Java SDK installation test code
The entry class of fabric-sdk-java is HFClient, so we can use the following simple code to create an instance of HFClient, and then set its security suite. If it can be compiled and executed normally, it means that Fabric Java SDK is installed successfully:
Package com.hubwiz.demo;import org.hyperledger.fabric.sdk.HFClient;import org.hyperledger.fabric.sdk.security.CryptoSuite;public class App {public static void main (String [] args) throws Exception {HFClient client = HFClient.createNewInstance (); client.setCryptoSuite (CryptoSuite.Factory.getCryptoSuite ()); System.out.println ("fabric-sdk-java installed successfully.") }} Thank you for reading this article carefully. I hope the article "how to install and use Hyperledger Fabric Java SDK in Maven, Gradle and Eclipse" shared by the editor will be helpful to you. At the same time, I hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!