本機是windows環境 java
1. 下載 protobuf最新版本:https://code.google.com/p/protobuf/downloads/detail?name=protobuf-2.5.0.tar.gz apache
2. 解壓後發現沒有包.java下面只有一個POM.xml. 用maven吧.(mvn3的環境本身上網找吧) windows
3. cmd進入protobuf-2.5.0\java\ 運行 mvn package maven
發現錯誤: ui
Java代碼
- [ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.3:run (generate-test-sources) on project protobuf-java: An Ant BuildException has occured: Execute failed: java.io.IOException: Cannot run program "..\src\protoc": CreateProcess error=2, ????????? -> [Help 1]
- [ERROR]
- [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
- [ERROR] Re-run Maven using the -X switch to enable full debug logging.
- [ERROR] For more information about the errors and possible solutions, please read the following articles:
- [ERROR] [Help 1]
看看到IOExcption,缺乏文件呀,上網找找資料,原來是缺乏protoc.exe google
4. copy文件protoc.exe 到protobuf-2.5.0\src\ 再次執行 mvn package spa
5. protobuf-2.5.0\java\target\protobuf-java-2.5.0.jar debug