A regular Java project in IntelliJ has this structure:
MyProject/
├── .idea/ # IntelliJ settings (git-ignored)
├── out/ # Compiled .class files (git-ignored)
├── src/ # Your Java source files
└── MyProject.iml # IntelliJ module file
- File → New → Project
- Select Java (not Maven or Gradle)
- Choose your Project SDK (Java 17)
- Next → Next → Enter project name and location
- Finish
- All
.javafiles go in thesrcfolder - IntelliJ automatically recognizes the package structure
- Example:
src/ ├── Main.java # Default package ├── com/ │ └── example/ │ ├── model/ │ │ └── Person.java # package com.example.model; │ └── util/ │ └── Helper.java # package com.example.util;
- IntelliJ compiles automatically on save (by default)
- Compiled
.classfiles go toout/production/ProjectName/ - Uses
javacbehind the scenes
- Right-click any class with
mainmethod → Run - Or click green arrow in the editor gutter
- IntelliJ creates run configurations automatically
- Project Structure (Ctrl+Alt+Shift+S or Cmd+;)
- Add JARs: Modules → Dependencies → + → JARs or directories
- Add other source folders: Modules → Sources → Mark as Sources
- Configure output paths: Modules → Paths
- Create a
libfolder in your project - Copy JAR files there
- Project Structure → Modules → Dependencies
- Click + → JARs or Directories → Select your lib folder
- Apply
| Feature | Maven/Gradle | Plain Java |
|---|---|---|
| Dependencies | Downloaded automatically | Manual JAR management |
| Project file | pom.xml / build.gradle | .iml file |
| Standard layout | Enforced (src/main/java) | Flexible (just src) |
| Test integration | Built-in test folders | Manual setup |
| Build lifecycle | Defined phases | Just compile & run |
| IDE independence | Portable | IntelliJ-specific |
MyProject/
├── src/
│ └── com/example/
│ └── Calculator.java
├── test/
│ └── com/example/
│ └── CalculatorTest.java
└── lib/
└── junit-4.13.2.jar
- Mark
testas Test Sources (green folder) - Add JUnit JAR as dependency
- Run tests with right-click → Run
- ✅ Simple and fast to set up
- ✅ No internet needed
- ✅ No build tool complexity
- ✅ Good for learning/teaching
- ✅ Works in restricted environments
- ❌ Manual dependency management
- ❌ Not portable between IDEs
- ❌ No standard project structure
- ❌ Harder to share projects
- ❌ No automated dependency updates
-
Create a Template Project
- Set up a basic project with common structure
- Save as template: File → Save as Template
-
Version Control
- Add to
.gitignore:.idea/ out/ *.iml
- Add to
-
Sharing Projects
- Include
src/andlib/folders - Document required JDK version
- Recipients recreate IntelliJ project
- Include
-
Running Outside IntelliJ
# Compile javac -d out src/com/example/*.java # Run java -cp out com.example.Main
This approach is perfect for teaching environments where build tools might be blocked or add unnecessary complexity!