.java

How to open a .java file

Quick, free ways to open Java on any system.

A .java file is a Java Source File. If double-clicking does nothing, your computer simply does not have an app that reads Java yet. Here is how to fix that on each operating system, using free software wherever possible.

Open a .java file step by step

  1. Confirm the file really is a .java. Drop it into the WhatFileType file identifier, which reads its signature without uploading anything.
  2. On Windows, open it with IntelliJ IDEA or Eclipse.
  3. On Mac, use IntelliJ IDEA or Eclipse.
  4. On Linux, try IntelliJ IDEA or Eclipse.
  5. Still stuck? Convert the .java to class (bytecode), which opens more widely.

Best apps to open .java files

Windows

  • IntelliJ IDEA
  • Eclipse
  • VS Code

macOS

  • IntelliJ IDEA
  • Eclipse
  • VS Code

Linux

  • IntelliJ IDEA
  • Eclipse
  • VS Code
!
Before you open it: Caution. A .java file is program source. Compiling and running it executes its code; review untrusted files first.

Frequently asked questions

Why can't I open my .java file?

Almost always because no installed app understands Java. Install one of the apps above, or convert the file to a format your existing software already reads.

How do I compile and run a .java file?

Compile with javac File.java to make File.class, then run java File. Modern JDKs can also run a single file directly with java File.java.

What is the difference between .java and .class?

A .java file is human-readable source. javac compiles it into a .class file of bytecode that the Java Virtual Machine executes.

Learn more about .java