Improve the outdated Java error message when syncing in idea.
This commit is contained in:
		
							parent
							
								
									8238db1778
								
							
						
					
					
						commit
						640e1b4721
					
				
					 1 changed files with 8 additions and 3 deletions
				
			
		|  | @ -29,12 +29,17 @@ public class LoomGradlePluginBootstrap implements Plugin<PluginAware> { | ||||||
| 		if (!isValidJavaRuntime()) { | 		if (!isValidJavaRuntime()) { | ||||||
| 			errors.add(String.format("You are using an outdated version of Java (%s). Java %d or higher is required.", JavaVersion.current().getMajorVersion(), MIN_SUPPORTED_MAJOR_JAVA_VERSION)); | 			errors.add(String.format("You are using an outdated version of Java (%s). Java %d or higher is required.", JavaVersion.current().getMajorVersion(), MIN_SUPPORTED_MAJOR_JAVA_VERSION)); | ||||||
| 
 | 
 | ||||||
|  | 			if (Boolean.getBoolean("idea.active")) { | ||||||
|  | 				// Idea specific error | ||||||
|  | 				errors.add("You can change the Java version in the Gradle settings dialog."); | ||||||
|  | 			} else { | ||||||
| 				String javaHome = System.getenv("JAVA_HOME"); | 				String javaHome = System.getenv("JAVA_HOME"); | ||||||
| 
 | 
 | ||||||
| 				if (javaHome != null) { | 				if (javaHome != null) { | ||||||
| 					errors.add(String.format("The JAVA_HOME environment variable is currently set to (%s).", javaHome)); | 					errors.add(String.format("The JAVA_HOME environment variable is currently set to (%s).", javaHome)); | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
|  | 		} | ||||||
| 
 | 
 | ||||||
| 		if (!errors.isEmpty()) { | 		if (!errors.isEmpty()) { | ||||||
| 			throw new UnsupportedOperationException(String.join("\n", errors)); | 			throw new UnsupportedOperationException(String.join("\n", errors)); | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue