I am new to Java, and installed the following JDK on Windows 10:
C:\Program Files\AdoptOpenJDK\jdk-11.0.8.10-openj9
I can invoke the compiler javac from Cygwin's Bash command line
(in an x-terminal), but it creates many errors that seem to go to
neither stdout or stderr. I need to send them to a file
that I can peruse with Vim.
Here is my invocation command
# mk.bash
# -------
javac \
-classpath "/c/Program Files/.../cplex.jar" \
TestSetup.java
The classpath argument is irrelevant here, as I
only want to focus on capturing javac's output in a Vim-perusable
way.
Issuing ./mk.bash >| mk.out generates an empty mk.out, as does
./mk.bash 2>&1 >| mk.out. I've used the latter pattern for decades
to redirect stderr to stdout and overwrite the destination file.
I can use the script command to send the javac output to mk.out:
script mk.out
./mk.bash
exit
I can then browse the error messages using Vim. However, the
contents are obfuscated by many binary characters (image & link to file below). Normally, I can
clean up messy files with dos2unix, but on this output, it quits due
to binary characters.
As another way to clean up the non-text content, Vim has a
fileformat=dos option which can be entered using :e ++ff=dos %.
The e and % says to edit the current file, while ++ff=dos says
to interpret the file as dos format (ff is fileformat). All
this does is clean up visual artifacts due to the different line
endings in Unix and DOS. All the error messages are still interspersed
with what seem like Escape characters ^[.
Is there any way to get javac to generate only plain text
output or to clean up the output?
Here is an image of the non-plain-text file in Vim:
I doubt it is all that relevant, but I'm following this webpage to
compile a simple Java app TestSetup.java that invokes a 3rd party
tool: https://kunlei.github.io/cplex/cplex-java-setup.

javac? I suspect there's some kind of colorising wrapper script involved. - Elliott Frischscript mk.out. As an added sleuthing step, I issuedjavac --helpto see if there might be command line options to force plain-text, but nothing was apparent. I'm hoping that an environment variable might be a possibility, but I don't know. Also, I'm using Bash in anxtermto invokejavacinstalled on Windows. - user2153235javacis binary, so if it is a wrapper, it isn't a script. I also triedjavac -classpath "c:\Program\ Files\...\cplex.jar" TestSetup.java 2> mk.outfrom the DOS command line. The output inmk.outis free of ANSI color code escapes. I need to find a way to do this from Bash. My way ahead is to compare environmental variables in the DOS and Bash command lines. - user2153235TERM, but unsetting that didn't change anything. A solution that did help was Vim's:terminalcommand. - user2153235