I tried to install protocol buffer compiler - Java in Ubuntu through reading README.txt file .
First i typed the following commands:
./configure
then
make
then
make check
then
make install
then
protoc --java_out=src/main/java -I../src \../src/google/protobuf/descriptor.proto
In this last step i have a problem that I don't know which paths should I put in this command.
protoc(1) --java_out=src/main/java(2) -I../src(3) ../src/google/protobuf/descriptor.proto(4)
protoc: main program
--java_out=OUT_DIR: Generate Java source files in OUT_DIR path (must exists).
-I (--proto_path) optional: Specify the directory in which to search for imports. May be specified multiple times; directories will be searched in order. If not given, the current working directory is used.
Your .proto descriptor file.
But you can simplify the command line with
protoc --java_out=src/main/java /path/to/my/proto/myproto.proto
Related
I'm using Saxon parser to create a report in the TFS build definition. I'm using the command line task as follows: java -jar "C:/Performance Tests/SaxonHE9-9-1-5J/saxon9he.jar" -s:"C:\Performance Tests\Script\results\Result.xml" -xsl:"C:\Performance Tests\JMeter\xslt\jm.xsl" -o:"C:\Performance Tests\Script\results\JMeterJunitReport.xml". I have installed java on agents (jre) and specified JRE_HOME and Path to Java in system variables.java -version command works fine on the agent. But when I try to run the task in TFS, I get the following error:
'java' is not recognized as an internal or external command,
operable program or batch file.
What could be the reason of such behavior? In a case with JMeter adding PATH to java to jmeter.bat helped. How to fix it with Saxon? I've tried to add set PATH="C:\Program Files\Java\jre1.8.0_231\bin";%PATH% to saxon9he.jar file which doesn't help. Other files in the Saxon folder are .jar and some .txt documents which don't seem to be appropriate here.
Thank you in advance 😊
The message means that the operating system can't find the "java" command. This has nothing to do with Saxon - if the OS can't load Java, then Java can't load Saxon, so there is no way Saxon can be part of the problem or part of the solution. In other words, you're barking up the wrong tree.
If Windows can't find a program to execute (in this case Java), that's because the program isn't on the PATH that Windows searches to find it. You either need to fix the PATH to include the Java executable, or you need to use a full path name when invoking it.
Note : I am unfamiliar with working at the command line, and my naive question will
most likely prompt a simple answer. With that in mind, read on :)
I downloaded the Apache PDFBox API into /c/Users/mount/Java/bin/pdfbox-2.0.3. My program files are unable to locate the contents of this API ( despite accurate import statements ).
How can I make javac and java aware of my downloaded Java API?
Below are my current settings for the commands and PATH.
PATH=$PATH:/c/Users/mount/Java/bin
alias javac="javac -cp /c/Users/mount/Java/JavaFX/jsoup_api:."
alias java="java -cp /c/Users/mount/Java/JavaFX/jsoup_api:/c/Program\ Files/Java/jdk1.8.0_101/lib:."
I have attempted to solve my problem by adding /c/Users/mount/Java/bin/pdfbox-2.0.3 to the end to each of these alias statements, however, that has not been successful. My Java program files are located in sub directories under /Java.
Your classpath should be set like this:
javac -cp lib/bar.jar com/example/Foo.java
So, only the full path to .jar (including the filename with extension!) is missing.
For exemple, the javac version should be like this:
alias javac="javac -cp /c/Users/mount/Java/JavaFX/jsoup_api:/c/Users/mount/Java/bin/pdfbox-2.0.3/pdfbox-app-2.0.3.jar:."
Just make sure that the .jar file exists!
I have downloaded protocol buffers (2.6.0) and I am trying to compile the .proto files. I run the following from inside the downloaded protobuf-2.6.0 directory
$ protoc --version
libprotoc-2.6.0
$ cd java
$ protoc --java_out=src/main/java -I../src ../src/google/protobuf/descriptor.proto
$ ls src/main/java
com
There are no errors on the protoc command, but the compilation should have generated source files in src/main/java/google/protobuf
--java_out specifies where generated Java source files should go
-I specifies the directory where imports can be found
I see nothing wrong with my command. Any ideas?
Thanks
Your -I option seems incomplete. It should be
-I../src/google/protobuf/
The question premise is false. The sources are being generated, but go under src/main/java/com/google/protobuf rather than src/main/java/google/protobuf as one might expect from the package name in descriptor.proto.
Edit - the java package name is given in the proto file like so:
package google.protobuf;
option java_package = "com.google.protobuf";
I tried installing protoc on windows without maven (I can't download maven due to org firewall issues).
I have my protoc.exe in the ..\src (not in java\src as many do) folder as mentioned in the readme.
When I give protoc --version in the command prompt, I get libprotoc 2.6.0. That's fine.
But when I give protoc --java_out=src/main/java -I../src/google/protobuf/descriptor.proto, I get missing input file all the time & I can't proceed further.
I have tried giving the entire path where my descriptor.proto lies, tried changing -I to -IPATH, tried using --proto_path but I still get the same Missing input file error.
Can someone help me out on this?
The command you want (from the Protobuf-Java readme) is:
protoc --java_out=src/main/java -I../src ../src/google/protobuf/descriptor.proto
Notice that the -I flag and the descriptor.proto argument are two different arguments. It looks like you accidentally merged them into one.
i 'm trying to do an application in java that use the treetagger.
so tapped this on eclipse
String commande="cmd /c C:\Program Files (x86)\tree-tagger-windows-3.2\TreeTagger\bin\\tag-english"+" "+path;
Process p=Runtime.getRuntime().exec(commande);
But it dosesn't work.
I have not much idea about the TreeTagger and to test if I install TreeTagger under windows I typed these commands on the command prompt cd C: \ Program Files (x86) \ tree-tagger-windows-3.2 \ TreeTagger \ bin and then
tag-English nom_de_fichier_Ã _tagger but the cmd displays this error message 'perl' is not recognized as an internal or external command, executable program or batch file.
the TreeTagger I install is a zip file I extracted to a folder and I put it in C: \ Program Files (x86) is what I did exactly
if I made a mistake during installation can you help me because I too searched the web and I understood nothing.
It sounds like you need to install a perl on windows. I suggest that you use Strawberry Perl.
I have no experience with TreeTagger, but doing a little googling points to this reference: TreeTagger - a language independent part-of-speech tagger. Scrolling down there is a Windows version in zip form, that contains an INSTALL.txt which states:
Installation
------------
1. Install a Perl interpreter (if you have not already installed one).
You can download a Perl interpreter for Windows for free at
http://www.activestate.com/activeperl/
2. Move the TreeTagger directory to the root directory of drive C:.
3. Download the PC parameter files for the languages you need, decompress
them (e.g. using Winzip or 7zip) and move them to the subdirectory lib.
Rename the parameter files to <language>.par
Example: Rename french-par-linux-3.1.bin to french.par
The UTF8 versions of the parameter files are not supported yet, but
see below some hints on how to build tagging scripts for the UTF8
parameter files.
4. Add the path C:\TreeTagger\bin to the PATH environment variable.
5. Open a shell and type the command
set PATH=C:\TreeTagger\bin;%PATH%
6. Change to the directory C:\TreeTagger
7. Now you can test the tagger, e.g. by analyzing this file with the command
tag-english INSTALL.txt
Obviously you must've skipped step 1. :) You could use ActiveState as they suggest, but these days Strawberry perl is a much better option in my opinion.