Online Java Compilers – 在线Java编译器

最后修改: 2018年 9月 30日

中文/混合/英文(键盘快捷键:t)

1. Introduction

1.介绍

An online compiler is a tool which allows us to compile the source code and execute it online. This is a great option, especially for new Java students, tutors, or interviewers. Additionally, it’s super easy to share the code or collaborate in private or group sessions.

在线编译器是一种允许我们在线编译源代码并执行的工具。这是一个很好的选择,特别是对于新的Java学生、辅导员或面试官来说。此外,分享代码或在私人或小组会议上进行协作也超级容易。

Besides that, we don’t need to install a JDK or IDE.

除此之外,我们不需要安装JDK或IDE

In this article, we’ll be exploring the top Java online compilers out there.

在这篇文章中,我们将探讨目前顶级的Java在线编译器。

2. JDoodle

2.JDoodle

JDoodle is an easy and quick way to compile and run source code in many programming languages including Java. Even more, JDoodle provides a terminal to work with MySql and MongoDB, peer programming tools, an API to execute code remotely, and an embedding feature for a blog or website.

JDoodle是一种简单快捷的方式,可以用包括Java在内的许多编程语言编译和运行源代码。更重要的是,JDoodle提供了一个与MySql和MongoDB合作的终端,同行编程工具,一个远程执行代码的API,以及一个用于博客或网站的嵌入功能。

Its UI has a user-friendly editor and input fields including:

其用户界面有一个用户友好的编辑器和输入字段,包括。

  • Command line arguments
  • Interactive mode
  • JDK versions 8 to 17 are available
  • Attaching external libraries directly from the Maven repository. All we need is to specify the group, artifact ids and the version of the library.

ojc jdoodle

Additionally, we can open, save, and download the source file.

此外,我们可以打开、保存和下载源文件。

Furthermore, the tool displays the compilation and execution along with CPU time in seconds. The memory usage is shown in kilobytes.

此外,该工具还显示了编译和执行,以及以秒为单位的CPU时间。内存使用量以千字节为单位显示。

Important to note, that JDoodle has one Basic IDE for simple single file programs and faster execution and another Advance IDE  for Multiple Files, Custom Library and File Read/Write.

需要注意的是,JDoodle有一个用于简单的单文件程序和快速执行的基本IDE,以及另一个用于多文件、自定义库和文件读/写的高级IDE。

3. Codiva

3.Codiva

This online compiler is definitely on the top due to its unique features. To begin working in Codiva, we need to start a new project.

由于其独特的功能,这个在线编译器绝对是名列前茅的。要开始在Codiva中工作,我们需要启动一个新项目。

Its design is similar to common IDE interfaces. We have a project structure on the left, and the source file editor on the right. By default, the working directory is src > hello > com > example. We can easily add new java files by clicking the + sign next to the file name.

它的设计类似于常见的IDE界面。我们在左边有一个项目结构,右边是源文件编辑器。默认情况下,工作目录是src > hello > com > example。我们可以通过点击文件名旁边的+符号来轻松添加新的java文件。

The source file immediately is added to the working tree:

源文件立即被添加到工作树中。

ojc codiva
To get started, let’s click the Run button on the top right side. It compiles the code as we start typing. Furthermore, Codiva shows all the errors during the compilation and displays the program execution result as we finish typing.

ojc codiva
为了开始,让我们点击右上方的Run按钮。当我们开始输入时,它就会编译代码。此外,Codiva显示了编译过程中的所有错误,并在我们完成输入后显示程序执行结果。

Additionally, it offers syntax highlighting and autocomplete to save time.

此外,它还提供语法高亮和自动完成功能,以节省时间

Last but not least, we can embed the Java project into any blog or website. First, we need to press the Share button and make the project public. After, Codiva gives two options for sharing:

最后但并非最不重要的是,我们可以将Java项目嵌入到任何博客或网站。首先,我们需要按下分享按钮,将项目公开。之后,Codiva给出了两个分享的选项。

  • A public URL
  • HTML code to copy and paste into our website

As a disadvantage, this tool doesn’t support compiler settings and works only for Java, C, C++ languages.

缺点是,这个工具不支持编译器设置,只对Java、C、C++语言有效。

4. Browxy

4.Browxy

Browxy works relatively fast compared to other online compilers. The available languages are C, C++, C#, Java, Python, and PHP.

Browxy与其他在线编译器相比工作速度相对较快。可用的语言有C、C++、C#、Java、Python和PHP。

We can easily share the source file across the web. The GetUrl button generates a URL to the file which allows us to share the file. Even more, logged in users can publish their code publicly.

我们可以轻松地在网络上分享源文件。GetUrl按钮会生成一个文件的URL,使我们可以分享该文件。甚至更多,登录的用户可以公开发布他们的代码

After hitting the Publish button, the project appears in the Published Code section:

点击发布按钮后,该项目出现在发布的代码部分。

ojc browxy

It has separate views for console, applet and logging outputs.

它对控制台、小程序和日志输出有单独的视图。

Another advantage is minimal restrictions for the running code. We can make external URL calls to test some APIs.

另一个优点是对运行代码的限制最小。我们可以进行外部URL调用来测试一些API。

5. Rextester

5.重测器

Initially, Rextester was designed as a regular expression tester. Later, it grew into online IDE supporting a vast majority of programming languages.

最初,Rextester被设计为一个正则表达式测试器。后来,它发展成为支持绝大多数编程语言的在线IDE。

It supports different editor and layouts views:

它支持不同的编辑器和布局视图。

ojc rexter

It is also worth mentioning the live cooperation feature. After pushing the appropriate button, Rextester generates a shareable URL.

还值得一提的是现场合作功能。按下相应的按钮后,Rextester会生成一个可分享的URL。

Anyone who has the URL can code in a permanent live session. We can see the changes that others make as well as be able to make our own.

任何拥有该网址的人都可以在一个永久的现场会议上编码。我们可以看到别人所做的修改,也可以做我们自己的修改。

6. OnlineGDB

6.OnlineGDB

OnlineGDB is a compiler and debugger for many coding languages including Java. Code formatting is also available to make coding more comfortable.

OnlineGDB是一个编译器和调试器,适用于许多编码语言,包括Java。还提供了代码格式化功能,使编码更加舒适。

Even more, we can add breakpoints by simply clicking on the rows we want to observe. After pushing the Debug button, the debugging mode starts. It will pass step by step over the breakpoints set previously.

甚至更多,我们可以通过简单地点击我们想要观察的行来添加断点。按下Debug按钮后,调试模式开始。它将一步一步地通过之前设置的断点。

The user can watch the local variable values or the call stack in appropriate windows:

用户可以在适当的窗口中观察局部变量值或调用栈。

ojc onlinegdb

7. Compilejava

7.编译java

Compilejava is an easy online tool to run Java code. It has many themes including the midnight, which is displayed in the screenshot. Java beginners, students, can use it for educational purposes.

Compilejava是一个简单的在线工具,用于运行Java代码。它有许多主题,包括截图中显示的midnight。Java初学者,学生,可以用它来进行教育。

It always runs on the latest version of Java. We can import code snippets from the Gist by providing the URL:

它总是在最新版本的Java上运行。我们可以通过提供URL从Gist中导入代码片断

ojc compileJava

8. Paiza.io

8.Paiza.io

This online compiler has friendly and easy to use interface. Like other advanced compilers, Paiza has all the features like:

这个在线编译器具有友好和易于使用的界面。像其他先进的编译器一样,Paiza具有所有的功能,如。

  • supporting multiple files
  • fast autocomplete
  • linking and sharing the code in GitHub or Gist
  • public or private sharing via the network
  • collaboration with the group of users
  • task scheduling

ojc paiza

It supports the majority of top programming languages including C, C++, C#, JVM languages and Python.

它支持大多数顶级编程语言,包括C、C++、C#、JVM语言和Python。

9. Remoteinterview

9.远程采访

RemoteInterview is focused and designed to assist the online interviewing process in most of the common programming languages. It offers live pair programming, sharing code snippets, making video calls, recording and saving the interview.

RemoteInterview专注于并旨在协助大多数常见编程语言的在线面试过程。它提供现场结对编程,分享代码片段,进行视频通话,记录和保存访谈内容。

The interviewer can invite anyone into a live session by sharing the invitation link:

面试官可以通过分享邀请链接来邀请任何人参加现场会议。

ojc interview

10. Ideone

10.伊德蒙

Ideone compiles and executes code in more than 60 programming languages. It allows code sharing as:

Ideone编译和执行60多种编程语言的代码。它允许代码共享,因为。

  • public – available to everyone
  • secret – available only to those with whom we share the URL
  • private – only available to the owner

ojc ideone

Ideone allows a time limit and memory usage constraints for the programs we submit:

Ideone允许我们提交的程序有时间限制和内存使用限制。

  • 10 seconds compilation time
  • 5 seconds execution time (for not logged in users) and 15 seconds for logged in users
  • 256 MB for the memory usage

Finally, under the samples section, we can find the latest runs and executed code snippets. We can fork and try them on our own.

最后,在samples部分,我们可以找到最新运行和执行的代码片段。我们可以分叉并自己尝试。

11. Repl.it

11.Repl.it

Repl.it has an interactive programming environment supporting many languages. Also, we can create a simple web project including HTML and JS files to practice basic web skills. Its very popular among teachers, interviewers, universities, and colleges.

Repl.it有一个互动的编程环境,支持许多语言。同时,我们可以创建一个简单的网络项目,包括HTML和JS文件,以练习基本的网络技能。它在教师、面试官、大学和学院中非常受欢迎。

First of all, we need to sign up on the platform. It is worth mentioning that this requirement doesn’t exist in any of the previously listed compilers:

首先,我们需要在该平台上注册。值得一提的是,这个要求在之前列出的任何一个编译器中都不存在。

ojc repl

One important feature is a built-in version control which allows to save the current work, work with the session later, or compare the changes with each version.

一个重要的功能是内置的版本控制,它允许保存当前的工作,在以后的会议上工作,或与每个版本的变化进行比较。

Additionally, it has a multi-functional terminal emulator, provides with the rich API and code sharing/collaboration tools, third-party library support.

此外,它有一个多功能的终端模拟器,提供丰富的API和代码共享/协作工具,支持第三方库。

12. Summary

12.总结

In this guide, we’ve presented a quick summary of the many available Java online compilers.

在本指南中,我们对许多可用的Java在线编译器进行了快速总结。

Some of them are offering unique features like compiling while typing, code hints, autocomplete, built-in debugging or code formatting.

其中一些提供了独特的功能,如边输入边编译、代码提示、自动完成、内置调试或代码格式化。

Despite that, modern online compilers are still limited in their capabilities when comparing to their desktop versions.

尽管如此,现代在线编译器与桌面版本相比,其能力仍然有限。