Lets say that the tshark command for piping the output from tshark is : tshark -i your_interface -n | your_program I would like to pipe the output from tshark to the java program. I compiled the java file and i piped the tshark output to the java program like this :
The error was thrown :
The question is what is the way to pipe the tshark output to the java program using tshark command? asked 01 May '12, 18:13 misteryuku edited 01 May '12, 23:57 grahamb ♦ |
2 Answers:
"could not find or load main class" is a Java error; there's something wrong with your program or with the way you're running it with the "java" command. I can't help you with that. "an error occurred while printing packets : invalid argument" may just be an error given when TShark tries to write to a pipe when the program on the other side of the pipe has terminated. answered 01 May '12, 19:17 Guy Harris ♦♦ |
---- "could not find or load main class" As already mentioned, there is something wrong with your java class file, most certainly the main method is missing in your class file. I think you will get more detailed information in a Java forum. Here is a working example: Echo.java
Compile it: javac Echo.java Run it: tshark -i 1 -n | java Echo Note: just 'java Echo' not 'java Echo.class', as it would expect a main method then! Output: Capturing on VMware Accelerated AMD PCNet Adapter (Microsoft's Packet Scheduler) Hint: This is buffered input stream reading, so it take some time until the code prints something on the CLI (the buffer needs to be filled first). ---- "tshark an error occurred while printing packets : invalid arguement" I have no idea where that comes from. Does this work without errors on your system: tshark -i 1 -n Regards answered 01 May '12, 21:56 Kurt Knochner ♦ |