Skip to content
language13 active rulesVerified 2026-09-30

Java .gitignore Template

Java compiled .class files, log files, jar archives, and virtual machine crash logs. Generated and merged deterministically with upstream GitHub repository patterns to keep your repository clean of package directories, temporary build artifacts, and local environment files.

Interactive Stack Generator

Open in Full Generator
Search for templates
Quick add:
Selected1
Java
Selected Templates (1)
.gitignore
### Java ###
# Compiled class file
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
replay_pid*
13 rules1 template26 lines
Deterministic

Raw Java .gitignore

Crawlable upstream source template
java.gitignore25 lines
# Compiled class file
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
replay_pid*

Key Pattern Breakdown

Build & Compilation Artifacts

Ignores compiled binaries, intermediate object files, and build output directories generated during development.

*.class*.jar*.war

Cache & Temporary Files

Ignores compiler caches, test runner coverage data, and transient temporary scratch files.

*.log.mtj.tmp/

Source & Verification

License:: CC0-1.0

Place this file in the root directory of your project as .gitignore. Changes take effect on newly added or untracked files.