IDEA: javac: source release 1.7 requires target release 1.7
When running a JUnit test in IntelliJ IDEA, users may encounter the error "javac: source release 1.7 requires target release 1.7." To address this issue, it is crucial to inspect and adjust the following settings:
1. Compiler Options
Verify the compiler options specified in IDEA. The issue could arise from incorrect options imported from Maven. Check under "Build, Execution, Deployment" > "Compiler" for incorrect settings.
2. Bytecode Version
Ensure the project and module bytecode (target) versions are set to 1.7 or higher. These settings can be found in "Project Structure" > "Project" and "Project Structure" > "Modules," respectively.
3. Other Source Language Level Settings
4. Maven Plugin Configuration
If the issue persists despite the above adjustments, check the Maven build configuration in pom.xml. The default language level in Maven is 1.5, but it can be overridden by specifying the following settings:
5. Maven Reimport
After modifying any Maven configuration, it is essential to "Reimport" the project in the "Maven Projects" tool window. This action ensures that IDEA aligns with the updated settings.
The above is the detailed content of How to Fix 'javac: source release 1.7 requires target release 1.7' in IntelliJ IDEA?. For more information, please follow other related articles on the PHP Chinese website!