.JAVA

Файл JAVA

Java source code file
Задать вопрос
БЫСТРЫЙ ОТВЕТ

A JAVA file is human-readable source code written in the Java programming language. Open it in any text editor or a Java IDE such as IntelliJ IDEA or VS Code. To run it, install a JDK, then compile with "javac App.java" and run with "java App"; on JDK 11+ you can also run it directly with "java App.java".

Разработчик: Sun Microsystems (now Oracle); the Java language is governed via the Java Community Process / OpenJDK Категория: Файлы разработчика Открыть стандартное MIME: text/x-java-source
ОТКРЫВАЕТСЯ НА Windows macOS Linux
Связанные: .DO · .MD · .HEX · .XSD

На этой странице

Проиндексировано расширений: 19k+
Последняя проверка: Jul 17, 2026

Не знаете, что это за файл?

Перетащите любой файл в наш идентификатор - мы прочитаем первые байты, чтобы определить формат.

Идентифицировать файл

Что такое формат файла JAVA?

A .java file is a plain-text source code file written in the Java programming language. Java is an object-oriented programming language built around the concepts of classes and objects. .java source files are compiled by the javac compiler into .class bytecode files; to run the resulting program, a Java Virtual Machine (JVM) is required. Java is also the primary language used for developing Android applications.

Object-oriented programming

Java was heavily influenced by C++, though it was designed from the ground up as a platform-independent language. The original designers accepted some trade-offs in raw execution speed in order to achieve "write once, run anywhere" portability; modern JIT (just-in-time) compilation has since closed much of that gap. .java files are built almost entirely from class, interface, enum, and record declarations, with only a small set of primitive types (such as int, boolean, and double) falling outside the object model. By convention, each .java file contains exactly one public type, and the file name must match that type's name - for example, App.java must contain public class App.

For simplicity, a class is a generalization - a template - of an object:

  • *Class:* human - *object:* Smith John
  • *Class:* airplane - *object:* Boeing 737

Each class defines the properties an object can have (for example, a car may have properties such as color, number of seats, etc.) and the methods it can execute - that is, the operations or actions it can perform (for example, a car object can accelerate, brake, and sound a horn). Classes can inherit from other classes or compose other classes, enabling code reuse and modular design.

Compiling a .java file with javac produces a .class file; multiple .class files are commonly packaged into a JAR archive for distribution. Since Java 11, a single-file .java program can also be launched directly with the java command without an explicit compile step.

Безопасность и защита

РИСК: LOW

A .java file is passive source text - opening or reading it cannot harm your computer. The risk appears only if you COMPILE and RUN it: like any program you build from someone else's code, it then executes with your permissions and could do anything the code says, so review or trust the source before running 'javac'/'java'. There is no auto-execution from merely viewing the file in an editor.

Детали формата

в двух словах
ПОЛНОЕ НАЗВАНИЕJava source code fileтакже известен как Java source file, Java class source
РАЗРАБОТЧИКSun Microsystems (now Oracle); the Java language is governed via the Java Community Process / OpenJDKс 1995 (Java 1.0, Sun Microsystems)
MIME-ТИПtext/x-java-source
ТИПPlain-text source code in the Java programming language (text)
СТАНДАРТОткрытый · без роялти
СВЯЗАННЫЕ.do.md.hex.xsd

Программы, открывающие файлы JAVA

Windows5 apps
Eclipse IDE Открытый код Import into a project to edit, compile and run the code.
Notepad Открытый код Open to view/edit the source with syntax highlighting (does not compile it).
IntelliJ IDEA (Community) Freemium Open the file or its project; full Java IDE with run/compile, the most popular choice for Java development.
Visual Studio Code (+ Java Extension Pack) Бесплатно Open the .java; install the 'Extension Pack for Java' to compile, run and debug.
JDK (javac / java) Открытый код To compile and run: install a JDK (OpenJDK/Temurin), then 'javac App.java' and 'java App' (or 'java App.java' to run a single file directly).
macOS3 apps
IntelliJ IDEA (Community) Freemium Open the file or its project; full Java IDE with run/compile, the most popular choice for Java development.
Visual Studio Code (+ Java Extension Pack) Бесплатно Open the .java; install the 'Extension Pack for Java' to compile, run and debug.
JDK (javac / java) Открытый код To compile and run: install a JDK (OpenJDK/Temurin), then 'javac App.java' and 'java App' (or 'java App.java' to run a single file directly).
Linux3 apps
Visual Studio Code / IntelliJ IDEA Бесплатно Open and edit the source; both run on Linux with full Java tooling.
GNU Emacs / Vim / gedit Открытый код View/edit the .java as text in any of these editors.
JDK (javac / java - OpenJDK) Открытый код Install 'default-jdk' or Temurin, then 'javac App.java' and 'java App'.

Технические подробности

глубокая спецификация
MIME typetext/x-java-source (also accepted as text/x-java)
Text encodingUTF-8; the default for javac since Java 18 (2022); older toolchains require an explicit -encoding flag
File signatureNone - plain text with no magic bytes; typically opens with a package declaration, import statements, or a class definition
Compilation outputjavac compiles each .java file into one or more .class bytecode files, one per type defined in the source
One public type per fileA public type's name must match the file name exactly - e.g. App.java must declare public class App; violating this is a compile error
File structure orderOptional package declaration → import statements → class, interface, enum, or record declarations containing fields and methods
Typical file size1 KB - 100 KB; a small utility class may be under 1 KB, a large class rarely exceeds 100 KB
Platform supportCross-platform: Windows, macOS, Linux, and any OS with a JDK installed; the same source compiles on all platforms
Language version mechanismSyntax level is not stored inside the file itself; it is controlled at compile time via javac --release N (e.g. --release 21)
Primitive typesEight built-in primitives - int, long, double, float, boolean, char, byte, short - exist alongside object types
Modern syntax additionsRecords (Java 16), sealed classes (Java 17), pattern matching for switch (Java 21), unnamed patterns and variables (Java 22)
Direct launch (Java 11+)A single-source .java file can be run with java FileName.java without a prior javac compile step
Deployment packagingMultiple compiled .class files are bundled into a .jar archive for distribution and execution on any JVM
Language stewardshipJava language specification maintained by Oracle; open-source implementation via OpenJDK under the Java Community Process (JCP)
Common development toolsIntelliJ IDEA, Eclipse IDE, and Visual Studio Code (with the Java Extension Pack) provide full language tooling for .java files
Выпущен1995 (Java 1.0, Sun Microsystems)
Последняя версияTracks the Java language version; Java 24 (2025) is current at time of writing
Открыть стандартноеДа · без роялти
Спецификацияdocs.oracle.com

Конвертации JAVA

Вопросы и ответы сообщества

спрошено пользователями
Задать быстрый вопрос
Получите помощь от людей, работающих с файлами JAVA. Будьте конкретны - укажите вашу систему и версию ПО.
Аккаунт не нужен · ответы обычно в течение дня

Вопросов пока нет - станьте первым, кто спросит о файлах JAVA.

Часто задаваемые вопросы

How do I open a .java file?
It's plain text - any editor opens it (Notepad++, VS Code). To work with it properly, use a Java IDE like IntelliJ IDEA (Community) or Eclipse, which add highlighting and let you compile and run the code.
How do I run a .java file?
Install a JDK (free OpenJDK/Temurin), then compile and run: 'javac App.java' creates App.class, and 'java App' runs it. On modern JDKs you can also run a single file directly with 'java App.java'.
What's the difference between .java, .class and .jar?
.java is the human-written source code; compiling it with javac produces .class bytecode; many .class files are bundled into a .jar to distribute a whole program. You edit .java, the JVM runs .class, and you ship .jar.
Do I need the full JDK or just Java to open a .java file?
To merely view/edit it, neither - any text editor works. To compile and run it you need a JDK (which includes javac); the consumer 'java.com' runtime only runs compiled bytecode, not source.
Can I turn a .java file into an .exe or an Android .apk?
Not directly. For Windows you compile to a JAR and wrap it (jpackage/Launch4j) - the result still needs Java. For Android you need a full project built into an APK by Android Studio; a single .java file can't become an APK.
Why does my .java file fail to compile with a 'class ... is public, should be declared in a file named ...' error?
Java requires a public top-level type's name to match the file name. Rename the file to match the public class (e.g. App.java for 'public class App'), or make the class non-public.

Ссылки

1Oracle - Java Language and VM Specificationsdocs.oracle.com
2Oracle - Getting Started / compiling and runningdev.java

Узнать больше

по всей базе данных

Популярные расширения на этой неделе

1.AQQAQQ Instant Messenger File
2.CRDOWNLOADChrome Partial Download File
3.MDMarkdown Document
4.BINCD/DVD Disc Image (BIN/CUE)
5.PARTPartial Download File
6.RPMSGRestricted Permission Message
7.NOMEDIAAndroid No-Media Marker File
8.EXEWindows Executable (Portable Executable)
9.AVIFAV1 Image File Format (AVIF)
10.ICSiCalendar data file

Похожие расширения

.DOStata Do-File
.MDMarkdown Document
.HEXIntel HEX File
.XSDXML Schema Definition
.MAPSource Map (JavaScript / CSS)
.CONFIGConfiguration File

Бесплатные инструменты для файлов

Идентификатор файлов и конвертер изображений в браузере - все работает на вашем устройстве.

Открыть инструменты

Обзор расширений файлов A-Z