What Is a JAVA File?

How to Open, Edit, and Convert JAVA Files

JAVA Files
JAVA Files.

A file with the JAVA file extension (or less commonly the .JAV suffix) is a Java Source Code file written in the Java programming language. It's a plain text file format that's completely readable in a text editor and essential to the entire process of building Java applications.

A JAVA file is used by a Java compiler to create a Java class files (.CLASS), which is usually a binary file and not human readable.

If the source code file contains multiple classes, each one is compiled into its own CLASS file.

It's the CLASS file that's then turned into an executable Java application with the JAR file extension. These Java Archive files make it easier to store and distribute .CLASS files and other Java application resources like images and sounds.

How to Open JAVA Files

Chances are slim that you have a program on your computer that will open a JAVA file when double-clicked. If you want to do that, see How to Change What Program Opens a File in Windows. Otherwise, use of the programs below to open the JAVA file, by first opening the software and then using the File menu to browse for the Java Source Code file.

The text within a JAVA file can be read by any text editor, like Notepad in Windows or the free Notepad++.

However, JAVA files are only actually useful when they're compiled into a bytecode CLASS file, which a Java SDK can do.

Data within the CLASS file is used by Oracle's Java Virtual Machine (JVM) once the JAR file has been created.

Use the following command in Command Prompt to open the JAVA file in the Java SDK, which will make a CLASS file from the JAVA file. Be sure to of course change the text within the quotes to be the actual path to your JAVA file.

javac "path-to-file.java"

Note: This "javac" command only works if you have the javac.exe file on your computer, which comes with the Java SDK installation. This EXE file is stored in the "bin" folder of the C:\Program Files\jdk(version)\ directory. The easiest way to use the command is to set the EXE file path as a PATH environment variable.

To edit JAVA files, you can use a program intended for application development, like Eclipse or JCreator LE. Text editors like NetBeans and Notepad++ can also be useful for modifying JAVA files.

How to Convert a JAVA File

Since a JAVA file contains the source code for a Java application, it's easily transferable to other applications or programming languages that can understand the code or translate it to something else.

For example, you can convert a JAVA file to a Kotlin file using IntelliJ IDEA. Either use the Code menu item to find the Convert Java file to Kotlin File option or access the Help > Find Action menu and start typing the action you want to complete, like "convert java file." It should save the JAVA file to a KT file.

Use the javac command mentioned above to convert JAVA to CLASS. If you can't seem to invoke the javac tool from Command Prompt, access the EXE file's location as described above, and then drag and drop the javac.exe file directly into Command Prompt to complete the command.

Once the file is in the CLASS file format, you can essentially convert JAVA to JAR using the jar command, as described in this Java tutorial from Oracle. It will make a JAR file using the CLASS file.

JSmooth and JexePack are two tools that can be used to convert the JAVA file to EXE so that the Java application can run like a normal Windows executable file.

Is Your File Still Not Opening?

The first thing you should do if your file isn't opening or converting with the tools described above, is to double-check the file extension. It's possible that you're not actually dealing with a JAVA file but instead a file that use a similarly spelled file extension.

For example, the AVA suffix looks a bit like JAVA but is used for AvaaBook eBook files. If you're dealing with an AVA file, it won't open with the programs from above but instead is only usable with the Persian AvaaPlayer software.

JA files might look like Java related files but they're actually Jet Archive files that store compressed game files. JVS files are similar but are JavaScript Proxy Autoconfig files that web browsers use to configure a proxy server.

Was this page helpful?