In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to develop ethernet application with Eclipse+Web3j". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "how to develop the ethernet application by Eclipse+Web3j".
1. Install Gradle
Download the latest version 4.8.1 Gradle package on the official website, and then select a directory to extract it, such as d:\ tool. There is no need to configure environment variables, just decompress it.
Note: the Gradle package contains a first-level gradle-4.8.1 directory, so the final installation directory is: d:\ tool\ gradle-4.8.1.
2. Install the Gradle plug-in
The latest Oxygen version of Eclipse already integrates the Gradle plug-in by default, so you can create a Gradle project directly:
If you need to install manually, click the menu _ _ [help] _-> [Eclipse Marketplace], then search for gradle, and select _ _ Buildship Gradle Integration 2.0 install _ to install:
3. Create a Gradle project
Select the menu _ [new] _-> [Project...], and select _ _ Gradle Project__: in the pop-up wizard dialog box.
Then give the project a name, such as test:
On the project options page, first enable the Override workspace settings option to fill in the Gradle installation directory, such as we installed to d:\ tool\ gradle-4.8.1:
4. Configure the Gradle project
Open the project's build.gradle file, add web3j and logback dependencies to dependencies, and add the maveCentral () repository:
Plugins {id 'java-library'} dependencies {api' org.apache.commons:commons-math4:3.6.1' implementation 'com.google.guava:guava:23.0' testImplementation' junit:junit:4.12' / / add web3j and logback dependencies on compile 'org.web3j:core:3.3.0',' ch.qos.logback:logback-core:1.2.3' 'ch.qos.logback:logback-classic:1.2.3'} repositories {jcenter () / / add maven warehouse mavenCentral ()}
Note: after updating the build.gradle file, be sure to perform a manual refresh to make the new settings take effect!
Right-click the project name in the _ _ Package Explorer__ window, and then click _ _ [graddle] _ _-> [Refresh Gradle Project]:
5. Create a new class
Create a new class App, and choose the default settings:
Then modify the App.java code as follows:
Package test;import org.web3j.protocol.Web3j;import org.web3j.protocol.http.HttpService;public class App {public static void main (String [] args) throws Exception {Web3j web3j = Web3j.build (new HttpService ("http://localhost:8545")); String v = web3j.web3ClientVersion (). Send (). GetWeb3ClientVersion (); System.out.println (v);}} 6, run
First, start ganache-cli on your local machine. For windows platform, it is recommended to use our Ethernet Fong development kit Ethbox:
Then click _ _ [run] _ _-> [Run As]-> [Java Application]:
If all goes well, you will first see Gradle downloading the dependency package on the Eclipse console, and then see the result of your code execution:
BINGO!
At this point, I believe you have a deeper understanding of "how to develop ethernet applications with Eclipse+Web3j". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.