I know this is a simple question but I am quite new to programming and I want to know if there is a way to get the output of a javap file to multiple different named text files. Eg. In the case of one output file it would be javap -c abc.class > nameOfTheFileYouWant.txt what about in the event that where I want it to output more than one uniquely named text file.
Asked
Active
Viewed 184 times
2 Answers
1
If you are using bash, then you can use tee
command as shown below
javap -c abc.class | tee file1.txt file2.txt file3.txt
In this specific example same output will be written to three files file1.txt
, file2.txt
and file3.txt

Sudhir
- 1,339
- 2
- 15
- 36
-
Is this solution then limited to the Unix platform? – DontKnowMuchBut Getting Better May 30 '20 at 15:54
-
1@DontKnowMuchButGettingBetter It works on Linux, Mac and Windows (with tools like Git bash) too – Sudhir May 30 '20 at 15:56
-
and what about where your dealing with multiple outputs required from like 700 class files where you cant name each text file individually? – Cat-M.bit May 30 '20 at 16:07
-
@Cat-M.bit if you want to disassemble multiple classes into their own files, then may be it is better to use a tool like [Java Decompiler](https://java-decompiler.github.io/) rather than `javap` command. Personally I have never done this and I am not sure if this toll can address your need. – Sudhir May 30 '20 at 16:13
-
Thanks for the feedback. Managed to get it working using Krakatau: https://github.com/Storyyeller/Krakatau – Cat-M.bit May 31 '20 at 11:12
0
The javap tool is used to get the information of any class or interface.The javap command disassembles one or more class files. Its output depends on the options used. If no options are used, javap prints out the package, protected, and public fields and methods of the classes passed to it. javap prints its output to stdout.

abhinav kumar
- 1,487
- 1
- 12
- 20