In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-08 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
Before you can develop protoc, you need to install the protoc compilation tool on your computer.
Download the compilation tool
Go to the source code of Protocol Buffers and select the released version to find the corresponding version. The link address for the project is: https://github.com/protocolbuffers/protobuf/releases
Then select https://github.com/protocolbuffers/protobuf/releases/download/v3.9.0/protoc-3.9.0-win64.zip and download the corresponding version.
Please note that if you download version 3.9.0 here, the corresponding version 3.9.0 is also required in the Gradle file of the project.
Please download the corresponding version.
Set environment variabl
After downloading the program, you need to set the bin directory in the download zip file to the environment variable.
Then run protoc-- version to make sure that your compiled run version is configured correctly.
From the following figure, you can view the configured folder.
Determine the correct configuration and compiler version by running protoc-- version.
Convert Java object
Suppose we have a proto file named simple.proto
The code for simple.proto is accessible from the https://github.com/cwiki-us-demo/protocol-buffers-demo-java/blob/master/src/main/proto/simple.proto page.
You can Clone the project locally and execute it.
You can generate a Java object based on the simple.proto file by running the following command
Protoc-proto_path=src-java_out=src/main/java src/main/proto/simple.proto
If the generated results are normal, there should be no output.
Then you can see the generated Java object when you visit a specific folder.
The path and file of the generated file are in the com.insight.demo.protocolbuffers.mode package.
Please note that you cannot compile this file manually, it should be automatically generated by the program.
GitHub sample source code
All the source code in this tutorial is accessible from the https://github.com/cwiki-us-demo/protocol-buffers-demo-java project in GitHub.
You can Clone the code to your local and run the test.
Https://www.cwiki.us/display/ProtocolBuffers/Protoc
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.