Open sjl opened 11 years ago
This should be possible. You'd need to figure out the equivalent command line for javac using java.
On Thu, Jul 11, 2013 at 9:37 AM, Steve Losh notifications@github.com wrote:
I'd like to use Drip to run
javac
commands (basically for checking the syntax of a file whenever I save it in Vim). I'm pretty surejavac ...
is just a wrapper around ajava
command so it should be possible to use Drip instead. Any idea how I might do that?Reply to this email directly or view it on GitHub: https://github.com/flatland/drip/issues/64
Yep, that's what I'm looking for but can't seem to find. It would be nice to have it in Drip's docs since a lot of people would probably find it useful.
The best I can find is that there's a programmatic interface for javac, so maybe write a small java program that takes the program to compile as an argument and uses the programmatic interface?
edit to add link to info on interface: http://docs.oracle.com/javase/7/docs/technotes/tools/windows/javac.html#proginterface
Apologies in advance if this is a dumb/obvious observation, but my javac
is a binary, and since the JRE includes the java
command but doesn't ship a compiler, it seems like javac
has to be much more than a wrapper around java
(unless the JDK ships a different java
command than the JRE?). What am I missing here?
http://openjdk.java.net/groups/compiler/ http://www.ahristov.com/tutorial/java-compiler/shell.html
Although the modern way to do it is creating a java main class that use the javax.tools.JavaCompiler
class it's still possible to use the deprecated sun.tools.javac.Main
class:
java -classpath /usr/lib/jvm/default-java/lib/tools.jar sun.tools.javac.Main MyClass.java
@trptcolin I guess that the only reason why javac
is not a script wrapper around java
is that not all system offer decent builtin script capabilities.
I'd like to use Drip to run
javac
commands (basically for checking the syntax of a file whenever I save it in Vim). I'm pretty surejavac ...
is just a wrapper around ajava
command so it should be possible to use Drip instead. Any idea how I might do that?