有没有类似 LINQPad for Java 的程序?

2022-01-20 00:00:00 ide java linqpad

我发现 LINQPad 在回答有关 C# 或 VB.NET 的 StackOverflow 问题时非常有用.它允许我编写一些快速代码,运行它,并且(如果我愿意)看到格式良好的结果转储.这样我就可以确定我发布的代码确实可以运行.到目前为止,我还没有看到任何东西可以用来通过 Java 实现相同的结果.那里有这样的东西吗?

我不是在寻找查询数据源的东西;我只想要一个轻量级的 IDE.这些是我特别感兴趣的功能:

  • 无需建立整个项目或文件结构即可编写和运行短代码片段的能力.
  • 在代码运行时报告编译器和运行时错误.
  • 添加对特定编辑器实例的引用的能力.
  • 语法突出显示和自动完成/智能感知将是一个加分项.

解决方案

因为我也找不到一个,所以我决定写一个.目前可以:

  1. 运行 java 片段(不需要类/导入/公共等等).
  2. 包含 MS/MySQL/Postgres 的驱动程序.
  3. 将结果输出为 HTML 表格

它非常粗糙,但我会随着时间的推移添加它.绝对欢迎提供反馈.

I've found LINQPad to be extremely useful when answering StackOverflow questions for C# or VB.NET. It allows me to write up some quick code, run it, and (if I want) see a nicely-formatted dump of the results. That way I can be sure that the code I post actually runs. Thus far I haven't seen anything that I can use to achieve the same result with Java. Is there anything like that out there?

I am not looking for something to query data sources; I just want a light-weight IDE. These are the features I'm particularly interested in:

  • The ability to write and run short snippets of code without establishing a whole project or file structure.
  • Reporting of compiler and runtime errors in the code when it is run.
  • The ability to add references to a particular editor instance.
  • Syntax highlighting and Autocomplete/Intellisense would be a plus.

解决方案

JPad - A java scratchpad for running snippets

Since I also couldn't find one I've decided to write one. Currently it can:

  1. Run java snippets (no class / imports / public blah... needed).
  2. Contains drivers for MS/MySQL/Postgres.
  3. Output results as HTML tables

It's very rough but I will add to it over time. Feedback is definitely welcome.

相关文章