Java2Html and IntelliJ IDEA
You can easily setup an External Tool in IDEA using the Java2Html command line options.
The problem is that I also wanted to:
- View the generated HTML code right away.
- Discard the resulting HTML file when done. I usually only need to copy/paste elsewhere.
I created a simple batch file to help me accomplish my goal…
java -jar java2html.jar -srcfile %1 -targetfile %TMPFILE%
What does it do?
- Passes the first argument (the path to the Java source file) to Java2Html.
- Instructs Java2Html to save the resulting HTML file directly to the Windows temporary files directory.
- Automatically opens the HTML file with Notepad.
To use it, simply place it in the same directory as the Java2Html jar, in my case C:\java2html.
The only thing left to do was to create the External Tool entry in IDEA, as follows: