ClassLoader classLoader = getClass().getClassLoader(); if (classLoader == null) { classLoader = ClassLoader.getSystemClassLoader(); }
	public void initDevice(List params, DeviceEntry defaultDevice) {		RecordStoreManager paramRecordStoreManager = null;				Class deviceClass = null;		String deviceDescriptorLocation = null;						Iterator it = params.iterator();		while (it.hasNext()) {			String tmp = (String) it.next();			if (tmp.equals("-d") || tmp.equals("--device")) {				it.remove();				if (it.hasNext()) {					String tmpDevice = (String) it.next();					it.remove();					if (!tmpDevice.toLowerCase().endsWith(".xml")) {						try {							deviceClass = Class.forName(tmpDevice);						} catch (ClassNotFoundException ex) {						}					}					if (deviceClass == null) {						deviceDescriptorLocation = tmpDevice;					}				}			} else if (tmp.equals("--rms")) {				it.remove();				if (it.hasNext()) {					String tmpRms = (String) it.next();					it.remove();					if (tmpRms.equals("file")) {						paramRecordStoreManager = new FileRecordStoreManager(launcher);					} else if (tmpRms.equals("memory")) {						paramRecordStoreManager = new MemoryRecordStoreManager();					}				}			}		}		if (deviceDescriptorLocation != null) {			try {				setDevice(Device.create(						emulatorContext, 						getClass().getClassLoader(), 						deviceDescriptorLocation));			} catch (IOException ex) {				ex.printStackTrace();			}		}		if (DeviceFactory.getDevice() == null) {			try {				if (deviceClass == null) {					ClassLoader classLoader = getClass().getClassLoader();					if (classLoader == null) {						classLoader = ClassLoader.getSystemClassLoader();					}					if (defaultDevice.getFileName() != null) {						URL[] urls = new URL[1];											urls[0] = new File(Config.getConfigPath(), defaultDevice.getFileName()).toURL();						classLoader = new URLClassLoader(urls);					}					setDevice(Device.create(							emulatorContext, 							classLoader, 							defaultDevice.getDescriptorLocation()));				} else {					Device device = (Device) deviceClass.newInstance();					device.init(emulatorContext);					setDevice(device);				}			} catch (InstantiationException ex) {				ex.printStackTrace();			} catch (IllegalAccessException ex) {				ex.printStackTrace();			} catch (IOException ex) {				ex.printStackTrace();			}		}		if (getRecordStoreManager() == null) {			if (paramRecordStoreManager == null) {				setRecordStoreManager(new FileRecordStoreManager(launcher));			} else {				setRecordStoreManager(paramRecordStoreManager);			}		}			}