How can I compile an Apache Thrift definition file?

时光毁灭记忆、已成空白 提交于 2019-12-10 17:32:06

问题


I'm trying to compile an Apache Thrift definition file (on Ubuntu). I keep getting the error message: Could not open input file with realpath: Calculator.thrift whenever I enter thrift -r --gen java Calculator.thrift into the command line. I have already installed Thrift. Where should I save .thrift definition files so that it will be possible to compile them?


回答1:


In the tutorial directory that comes with the thrift installation, you should see the following 2 *.thrift files:

shared.thrift
tutorial.thrift

From this same directory you should be able to generate/compile from the thrift IDL files as follows:

thrift -r --gen java ./tutorial.thrift

This should create a gen-java sub-directory in the tutorial directory.

The Calculator.thrift file does not actually exist, the Calculator service is defined in tutorial.thrift. The error is trying to tell you that it cant find the file, and rightly so, since it doesnt actually exist :)



来源:https://stackoverflow.com/questions/12241306/how-can-i-compile-an-apache-thrift-definition-file

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!