protobuf 生成对应的文件

protoc –java_out=../ –proto_path= .\addressbook.proto

上面的是根据proto文件生成java文件.

1,其中–java_out=../ 表示输出java在当前的目录下
2.表示–proto_path= .\addressbook.proto proto的目录 ./代表当前的目录.
3.建议还是根据就官方的来吧.我现在用上面的指令运行不了


上面的以前写的,辣鸡。看这里进行编译就可以了。。
4.用下面的语句我编译出来了。重点是./ 当前目录 后面直接跟空格 addressbook.proto然后资源文件

E:\worktemp\googleprotobuf>protoc.exe –java_out=./ addressbook.proto


如果报

Unknown flag: -j
错误说明:你需要两个破折号

如果报input file not find

If you haven't installed the compiler, download the package and follow the instructions in the README.
Now run the compiler, specifying the source directory (where your application's source code lives – the current directory is used if you don't provide a value), the destination directory (where you want the generated code to go; often the same as $SRC_DIR), and the path to your .proto. In this case, you...:
**protoc -I=$SRC_DIR --java_out=$DST_DIR $SRC_DIR/addressbook.proto**
Because you want Java classes, you use the --java_out option – similar options are provided for other supported languages.

protoc -I= SRCDIRjavaout= DST_DIR $SRC_DIR/addressbook.proto
就是直接使用官方的配置吧.
上面的写的不对
参考链接

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值