preprocess( device ); compile( device ); if (this.doObfuscate) { obfuscate( device ); } if (this.buildSetting.isInCompilerMode()) { System.out.println(); System.out.println("Successfully processed the activated compilerMode of J2ME Polish."); return; } preverify( device ); jar( device ); jad( device ); if (hasExtensions) { callExtensions( device ); } if (this.emulatorSetting != null) { runEmulator( device );
if (this.supportedLocales != null) { for (int j = 0; j < this.supportedLocales.length; j++) { Locale locale = this.supportedLocales[j]; System.out.println("Using locale [" + locale.toString() + "]..."); execute(device, locale, hasExtensions); if (this.buildSetting.isInCompilerMode()) {  return; } } } else { execute(device, null, hasExtensions); if (this.buildSetting.isInCompilerMode()) {  return; }
	public void execute() throws BuildException {		System.out.println("J2ME Polish " + VERSION );		if (!isActive()) {			return;		}		try {			checkSettings();			initProject();			selectDevices();			int numberOfDevices = this.devices.length;			if (this.buildSetting.isInCompilerMode()) {				System.out.println("Using J2ME Polish as compiler...");			} else if (numberOfDevices > 1) {				System.out.println("Processing [" + numberOfDevices + "] devices...");			}			boolean hasExtensions = (this.javaExtensions.length > 0);			for ( int i=0; i < numberOfDevices; i++) {				Device device = this.devices[i];				if (numberOfDevices > 1) {					System.out.println("Building application for [" + device.getIdentifier() + "] (" + (i+1) + "/" + numberOfDevices + "):");				}				preprocess( device );				compile( device );				if (this.doObfuscate) {					obfuscate( device );				}				if (this.buildSetting.isInCompilerMode()) {					System.out.println();					System.out.println("Successfully processed the activated compilerMode of J2ME Polish.");					return;				}				preverify( device );				jar( device );				jad( device );				if (hasExtensions) {					callExtensions( device );				}				if (this.emulatorSetting != null) {					runEmulator( device );				}				if (numberOfDevices > 1) {					// print an empty as a separator between different devices: 					System.out.println();				}			}			test();			deploy();			finishProject();			if (numberOfDevices > 1) {				System.out.println("Successfully processed [" + numberOfDevices + "] devices.");			}		} catch (BuildException e) {			//e.printStackTrace();			throw e;		} catch (Exception e) {			e.printStackTrace();			throw new BuildException("Unable to execute J2ME Polish task: " + e.toString(), e );		}		if (this.runningEmulators != null) {			System.out.println("Waiting for emulators...");			while (this.runningEmulators.size() > 0) {				Emulator[] emulators = (Emulator[]) this.runningEmulators.toArray( new Emulator[ this.runningEmulators.size() ]);				for (int i = 0; i < emulators.length; i++) {					Emulator emulator = emulators[i];					if (emulator.isFinished()) {						this.runningEmulators.remove( emulator );					}									}				if (this.runningEmulators.size() > 0) {					try {						Thread.sleep( 2000 );					} catch (InterruptedException e1) {						// ignore					}				}			}		}	}