} if (!midletFound) { throw new BuildException("The MIDlet [" + midlet.getClassName() + "] could not be found. Check your <midlet>-setting in the file [build.xml] or adjust the [sourceDir] attribute of the <build>-element.");
if (!midletFound) { throw new BuildException("The MIDlet [" + midlet.getClassName() + "] could not be found. Check your <midlet>-setting in the file [build.xml] or adjust the [sourceDir] attribute of the <build>-element."); }
	private void checkSettings() {		//System.out.println( this.project.getBaseDir().getAbsolutePath() );		if (this.infoSetting == null) {			throw new BuildException("Nested element [info] is required.");		}		if (this.buildSetting == null) {			throw new BuildException("Nested element [build] is required.");		}		if (this.deviceRequirements == null) {			log("Nested element [deviceRequirements] is missing, now the project will be optimized for all known devices.");		}		// check the nested element of <build>:		Midlet[] midlets = this.buildSetting.getMidlets(); 		if (midlets == null || midlets.length == 0) {			throw new BuildException("Midlets need to be defined in the <build>-section with either <midlets> or <midlet>.");		}		// now check if the midlets do exist:		File[] sources = this.buildSetting.getSourceDirs();		for (int i = 0; i < midlets.length; i++) {			Midlet midlet = midlets[i];			String fileName = TextUtil.replace( midlet.getClassName(), '.', File.separatorChar) + ".java";			boolean midletFound = false;			for (int j = 0; j < sources.length; j++) {				File sourceDir = sources[j];				String sourceDirPath = sourceDir.getAbsolutePath();				File midletFile = new File( sourceDirPath + File.separator + fileName );				if (midletFile.exists()) {					midletFound = true;					break;				}			}			if (!midletFound) {				throw new BuildException("The MIDlet [" + midlet.getClassName() + "] could not be found. Check your <midlet>-setting in the file [build.xml] or adjust the [sourceDir] attribute of the <build>-element.");			}		}		// check if the ant-property WTK_HOME has been set:		//e.g. with: <property name="wtk.home" value="c:\Java\wtk-1.0.4"/>		this.wtkHome = this.project.getProperty("wtk.home");		if (this.buildSetting.getPreverify() == null) {			// no preverify has been set, that's okay when the wtk.home ant-property has been set:			if (this.wtkHome == null) { 				throw new BuildException("Nested element [build] needs to define the attribute [preverify] which points to the preverify-executable of the wireless toolkit. Alternatively you can set the home directory of the Wireless Toolkit by defining the Ant-property [wtk.home]: <property name=\"wtk.home\" location=\"/home/user/WTK2.1\"/>");			}			if (!this.wtkHome.endsWith( File.separator )) {				this.wtkHome += File.separator;			}			String preverifyPath = this.wtkHome + "bin" + File.separator + "preverify";			if ( File.separatorChar == '\\') {				preverifyPath += ".exe";			}			File preverifyFile = new File( preverifyPath );			if (preverifyFile.exists()) {				this.buildSetting.setPreverify( preverifyFile.getAbsolutePath() );			} else {				// probably the wtk.home path is wrong:				File file = new File( this.wtkHome );				if (!file.exists()) {					throw new BuildException("The Ant-property [wtk.home] points to a non-existing directory. Please adjust his setting in the build.xml file.");				} else {					throw new BuildException("Unable to find the preverify tool at the default location [" + preverifyPath + "]. Please specify where to find it with the \"preverify\"-attribute of the <build> element (in the build.xml file).");				}			}		}	}