Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using drip for javac #64

Open
sjl opened this issue Jul 11, 2013 · 5 comments
Open

Using drip for javac #64

sjl opened this issue Jul 11, 2013 · 5 comments

Comments

@sjl
Copy link

sjl commented Jul 11, 2013

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 sure javac ... is just a wrapper around a java command so it should be possible to use Drip instead. Any idea how I might do that?

@ninjudd
Copy link
Owner

ninjudd commented Jul 11, 2013

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 [email protected]
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 sure javac ... is just a wrapper around a java 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

@sjl
Copy link
Author

sjl commented Jul 14, 2013

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.

@mattboehm
Copy link

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

@trptcolin
Copy link

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

@jeromerobert
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants