When using javac (or the ant task ), the error message does not include the entire filepath, it only includes the file name. For example,
$ javac src/path/to/Filename.java
Filename.java:1: package foo.bar does not exist
import foo.bar.Baz;
^
What I would like is,
$ javac src/path/to/Filename.java
src/path/to/Filename.java:1: package foo.bar does not exist
import foo.bar.Baz;
^
My problem is that vim quickfix does not work if it's not given the entire filepath, not just the filename. With just the filename, a new empty file is opened up after running :make.
I'm using:
I don't think there is a simple way to do this.
However, I believe that there is a complicated way. It basically involves writing your own compiler runner that makes use of a JDK installation's ability to load and run the Java compiler inside of a running program. You need to implement a lot of stuff, but the key thing is a diagnostic processor that formats the compiler error messages in the way that you need them to be formatted.
Here are some relevant links:
javax.tools
- provides interfaces for tools which can be invoked from a program, for example, compilers. JavaCompiler
- the interface implemented by the compilerFileObject
- the interface that the compiler uses to represent source files; e.g. in diagnostics. Note the toUri()
method!If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With