Alex Dukhan
Alex Dukhan

Reputation: 61

Forcing Visual Studios 2017 to compile and run Java

I'm currently using visual studios and love the IDE. The problem is that the main language is Java. I've been using this batch file as an external tool for compiling and running.

del Output /S /Q
mkdir Output
javac *.java -d Output
cd Output
java Main

The problem is it only allows one program at a time and this makes things hard. Is there any way to adapt this so that is gets the filename of the .java file and compiles that.

***Solved: the new code is:

del Output /S /Q
mkdir Output
javac %1.java -d Output
cd Output
java %1

Then I set the argument to be the file name.

Upvotes: 0

Views: 3579

Answers (1)

Ken Tucker
Ken Tucker

Reputation: 4156

There is a third party visual studio extension which allow you to use java in visual studio

https://marketplace.visualstudio.com/items?itemName=SamHarwell.JavaLanguageSupport

Upvotes: 1

Related Questions