Wondering if you can run your Java program in an external window?
Answered
Instead of running a Java program in the console window which is at the bottom of the interface, I was wondering if there is a way to tell IntelliJ to run your code in an external window. Like I've used some products where you can set it up so your program runs in an external DOS window (not the Windows command prompt though).
Just wondering...
Please sign in to leave a comment.
There is a feature request to allow running in the external console, see https://youtrack.jetbrains.com/issue/IDEABKL-6701.
At the moment you can configure the External Tool which will spawn a console and run your app there, but IDE integration will be not available for this console (however, you can still use Remote Debug).
What's the use case for your specific application?
Can you assist me in what to specifically enter in the boxes where you have to configure the external tool? This is what I don't know how to do.
In Working Directory I have this: $ProjectFileDir$
In Parameters I have this: $FilePath$
I have no idea what to put in Program so here is what I currently have: D:\Java Projects\src\SimpleProgram.java
Right now the tool is not working. IntelliJ is complaining about not a valid Win32 something or other.
I don't know specifically what to enter in that box.
I can tell you that the name of my Java program is Simple Program. And it is found on my D:\ drive in my Java Projects folder.
It's not that simple. .java is the source of your app that you can't run directly. javac compiles it into .class file which can be executed by java VM. But in real world apps you will also have the dependencies (jars) that have to be specified via classpath.
So, the easy way would be to run the app from IDEA and see its output in the console, on the top you will notice the full command line used to start the app (click to expand). You can copy this command line and use it as the starting point for your external tool. Escaping spaces in paths can be also tricky.