Reputation: 13
I'm trying to create a drag and drop shortcut for compiling and running java files, rather than a command line interface. I'm thinking, I will create two batch files. But, what do I write to make the batch files use javac.exe or java.exe on what ever java files are dropped onto the batch files?
For the compiler batch file:
cd C:\Program Files\Java\jdk\bin
javac [what goes here?]
pause
For the run java batch file:
cd C:\Program Files\Java\jdk\bin
java [what goes here?]
pause
Upvotes: 1
Views: 2733
Reputation: 81694
Don't bother; you would find these batch files useful for about one day. After that, your Java programs will contain multiple *.java
files and depend on various *.jar
files. Learn to use Ant, which can handle build processes from the simplest to the most complex.
But for completeness, the files DnD'd onto a batch file are available as if they were passed as arguments to the batch file at the command line, so your "[what goes here?]" is "%1", or, if you anticipate multiple files, "%1 %2 %3 %4 %5 %6 %7 %8 %9" .
Upvotes: 5