---
title: "Java Online Compiler and IDE | CoderPad"
description: "You should define a public class named Solution with a public static void main. Your code is compiled with -Xlint (linting) and run"
canonical: "https://coderpad.io/languages/java/"
last_modified: "2025-09-05 07:11:32"
---
# Java online compiler and IDE

Running OpenJDK 20 – IntelliSense is enabled

### Experience the Java IDE yourself

See just how easy and intuitive CoderPad Interview is to use below.

[Start coding](https://embed.coderpad.io/sandbox?question_id=247188&use_question_button)

[Launch the environment](https://embed.coderpad.io/sandbox?question_id=247188&use_question_button)

## Guidelines to use Java in this online IDE

You should define a public class named`Solution`with a`public static void main`. Your code is compiled with`-Xlint`(linting) and run with`-ea`(assertions enabled).

A few libraries are included for your convenience, and are available on the classpath with no additional work from you. Simply import and they’re available for use:

- [json-simple](https://code.google.com/p/json-simple) for parsing/encoding JSON.
- [guava](https://code.google.com/p/guava-libraries) provides immutable collections and other handy utility classes.
- [Apache Commons Lang](https://commons.apache.org/proper/commons-lang/) for assorted utilities. The import prefix is`org.apache.commons.lang3`, so you can perform imports by writing`import org.apache.commons.lang3.ArrayUtils`.
- [JUnit](http://junit.org/), the gold standard for testing in Java. If you want to ask your candidate to write JUnit-style tests during the interview, please format your Java code like so (stack traces originating from JUnit errors are trimmed for brevity):

```
  import org.junit.*;
  import org.junit.runner.*;

  public class Solution {
    @Test
    public void testNoop() {
      Assert.assertTrue(true);
    }

    public static void main(String[] args) {
      JUnitCore.main("Solution");
    }
  }
Code language: Java (java)
```
- [jMock](http://www.jmock.org/), a library to assist with mocking in Java. Combining jMock with the previous JUnit example:

```
  import org.jmock.*;
  import org.junit.*;
  import org.junit.runner.*;

  interface Receiver {
    void receive(String message);
  }

  public class Solution {
    @Test
    public void testMock() {
      Mockery context = new Mockery();
      Receiver receiver = context.mock(Receiver.class);
      context.checking(new Expectations() {{
        oneOf (receiver).receive("hello");
      }});
      receiver.receive("hello");
      context.assertIsSatisfied();
    }

    public static void main(String[] args) {
      JUnitCore.main("Solution");
    }
  }
Code language: Java (java)
```

## Need a better way to interview candidates?

[Request a demo](https://coderpad.io/sales/)
