I'm looking for a quick way to run multiple blocks of Java code from Stack Overflow one code block at a time. Many Java questions at Stack Overflow have multiple answers, and I want to test most or all of the answers to a given question with my own data to determine if the code works or not. For the purpose of answering this question the Java code block doesn't need to be executable as is, because I can edit the code and add the first line(s) of code and their closing bracket(s) and the data so that the code block runs and gives output. Console output would be enough.
I will accept recommendations for applications that run on either Windows or Linux. I prefer free software, but it is not a requirement. I require a GUI application that has these features.
I don't want to have to create a project each time I run a new block of Java code. I want to copy/paste a code block and run it without making a project of any kind. The reason for this is I expect to reject most of the code blocks that I try, and I don't want to clutter my system with a lot of useless projects. That rules out some Java IDEs that I know about. I only expect to save the best code block, and I want to save this code block as a single file, not as a project.
Because the code blocks don't need to be executable as is (I can edit them), I need the application to have the ability to do a small amount of basic debugging of Java code, for example identifying syntax errors. I don't need anything fancy like breakpoints.
I am looking for a GUI application, not a command line program so that I can easily see what I am doing. If a line of code contains a small error I want to be able to right-click it to show a few suggestions for how to fix the error.
The application must support syntax highlighting.
I'm not looking for an online application. I want an application that I can install and use offline.