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.


I usally have an empty project in a folder and if i have to test sth really quick i open up the empty project.

Maybe you could try visual studio code with a java plugin. It opens up pretty fast and you can just run .java files.

  • I don't want to make a project. I want to run the code directly from a single file inside the application. When I'm finished running the code I want to either delete that file or save it. – karel Jul 29 at 14:36
  • you can do this with visual studio code. Click new file, paste the code into the file, save the file as java file, run the code. If the code sucked test the next one. Save the file e.g to your desktop so you can delete it easy later – Julian Schubert Jul 29 at 14:37
  • That's what I want to do. I want to save the file to my desktop so I know where it is and I can delete it as soon as I'm finished with it. That way I can easily see whatever files that I'm working on, and if I'm interrupted then I can see where my files are the next time I login. – karel Jul 29 at 14:39
  • Is your problem now solved? – Julian Schubert Jul 29 at 14:41
  • 1
    That's part of the question, so please put that in the answer where everyone can read it. It's a good idea, but it's like "Die Winterreise" unless I can get it to run. – karel Jul 29 at 15:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.