List of usage examples for java.lang ClassLoader getResourceAsStream
public InputStream getResourceAsStream(String name)
From source file:com.elecnor.ecosystem.serviceimpl.LicenseDirectoryServiceImpl.java
public Integer readFromLocalHeader(ArrayList<String> excelHeader, String valToCheck) { int result = 0; try {//from ww w . j a v a 2 s .c o m ClassLoader cl = PropertyFileReader.class.getClassLoader(); InputStream in = cl.getResourceAsStream("header.properties"); Properties prop = new Properties(); prop.load(in); if (valToCheck == null) { String excelUploadedHeader = excelHeader.toString().substring(1, excelHeader.toString().indexOf("]")); if (excelUploadedHeader .equalsIgnoreCase(prop.getProperty(ConstantUtil.LOCAL_LICENSE_EXCEL_FORMAT))) { result = 1; } else { result = 0; } } else { return Integer.valueOf(prop.getProperty(valToCheck)); } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } return result; }
From source file:de.micromata.genome.gwiki.controls.GWikiGenDocActionBean.java
protected String patchEntities(String htmlData) throws IOException { int idx = htmlData.indexOf("<HTML>"); if (idx == -1) { return htmlData; }//w w w .j av a 2s. co m htmlData = StringUtils.replace(htmlData, "<BR></BR>", "<BR/>"); htmlData = StringUtils.replace(htmlData, "<BR>", "<BR/>"); ClassLoader cl = Thread.currentThread().getContextClassLoader(); StringBuilder sb = new StringBuilder(); boolean withXml = false; boolean xhtmldocType = false; if (withXml == true) { sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"); } if (xhtmldocType == true) { sb.append( "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n"); } else { sb.append("<!DOCTYPE HTML [\n"); InputStream entis = cl.getResourceAsStream("xhtml-lat1.ent"); sb.append(new String(IOUtils.toByteArray(entis))); entis = cl.getResourceAsStream("xhtml-special.ent"); sb.append(new String(IOUtils.toByteArray(entis))); entis = cl.getResourceAsStream("xhtml-symbol.ent"); sb.append(new String(IOUtils.toByteArray(entis))); sb.append("]\n>\n"); } htmlData = htmlData.substring(idx); Pattern p = Pattern.compile("\\</{0,1}(\\w+)"); htmlData = StringUtils.replace(htmlData, p, 1, new CallableX1<String, String, RuntimeException>() { @Override public String call(String arg1) throws RuntimeException { return arg1.toLowerCase(); } }); sb.append(htmlData); return sb.toString(); }
From source file:com.meiah.core.util.StringUtil.java
public static String read(ClassLoader classLoader, String name, boolean all) throws IOException { if (all) {/* ww w . j av a 2s . c o m*/ StringBuffer sm = new StringBuffer(); Enumeration enu = classLoader.getResources(name); while (enu.hasMoreElements()) { URL url = (URL) enu.nextElement(); InputStream is = url.openStream(); String s = read(is); if (s != null) { sm.append(s); sm.append(StringPool.NEW_LINE); } is.close(); } return sm.toString().trim(); } else { InputStream is = classLoader.getResourceAsStream(name); String s = read(is); is.close(); return s; } }
From source file:org.alfresco.contentstore.ChecksumTest.java
@Test public void test3() throws IOException { checksumService.setBlockSize(8192);/*from w w w . j a v a 2 s .com*/ UserContext.setUser("user1"); File f = TempFileProvider.createTempFile("ContentStoreTest", GUID.generate()); // File f = copy("marbles-uncompressed.tif"); System.out.println("f = " + f); Node node = Node.build().nodeId(GUID.generate()).nodeVersion(1l); ClassLoader cl = getClass().getClassLoader(); try (InputStream in = getClass().getClassLoader().getResourceAsStream("marbles-uncompressed.tif")) { NodeChecksums checksums = checksumService.getChecksums(node, in); try (ReadableByteChannel destChannel = Channels .newChannel(cl.getResourceAsStream("marbles-uncompressed1.tif")); ReadableByteChannel srcChannel = Channels .newChannel(cl.getResourceAsStream("marbles-uncompressed.tif")); FileOutputStream fos = new FileOutputStream(f); WritableByteChannel patchedChannel = fos.getChannel()) { PatchDocument patchDocument = new PatchDocumentImpl(); patchService.updatePatchDocument(patchDocument, checksums, destChannel); System.out.println("patchDocument = " + patchDocument); int totalWritten = applyPatch(srcChannel, patchedChannel, patchDocument); System.out.println("totalWritten = " + totalWritten); } } try (InputStream in3 = getClass().getClassLoader().getResourceAsStream("marbles-uncompressed1.tif"); InputStream in4 = new FileInputStream(f)) { assertEqual(in3, in4); } }
From source file:com.krawler.portal.util.StringUtil.java
public static String read(ClassLoader classLoader, String name, boolean all) throws IOException { if (all) {/* ww w. j a v a 2 s . c o m*/ StringBuilder sb = new StringBuilder(); Enumeration<URL> enu = classLoader.getResources(name); while (enu.hasMoreElements()) { URL url = enu.nextElement(); InputStream is = url.openStream(); String s = read(is); if (s != null) { sb.append(s); sb.append(StringPool.NEW_LINE); } is.close(); } return sb.toString().trim(); } else { InputStream is = classLoader.getResourceAsStream(name); String s = read(is); is.close(); return s; } }
From source file:org.apache.sling.testing.mock.sling.NodeTypeDefinitionScanner.java
/** * Register node types found in classpath in JCR repository, and remove those that succeeded to register from the list. * @param nodeTypeResources List of nodetype classpath resources * @param classLoader/*from ww w . j av a 2 s .c o m*/ * @param nodeTypeManager * @param namespaceRegistry * @param valueFactory * @param logError if true, and error is logged if node type registration failed. Otherwise it is ignored. */ private void registerNodeTypesAndRemoveSucceeds(List<String> nodeTypeResources, ClassLoader classLoader, NodeTypeManager nodeTypeManager, NamespaceRegistry namespaceRegistry, ValueFactory valueFactory, boolean logError) { Iterator<String> nodeTypeResourcesIterator = nodeTypeResources.iterator(); while (nodeTypeResourcesIterator.hasNext()) { String nodeTypeResource = nodeTypeResourcesIterator.next(); InputStream is = classLoader.getResourceAsStream(nodeTypeResource); if (is == null) { continue; } try { Reader reader = new InputStreamReader(is); CndImporter.registerNodeTypes(reader, nodeTypeResource, nodeTypeManager, namespaceRegistry, valueFactory, false); nodeTypeResourcesIterator.remove(); } catch (Throwable ex) { if (logError) { log.warn("Unable to register node type: " + nodeTypeResource, ex); } } finally { IOUtils.closeQuietly(is); } } }
From source file:com.github.fengtan.sophie.toolbars.DocumentsToolbar.java
/** * Populate toolbar with buttons.//from ww w . j ava 2 s . c o m * * @param composite * Parent composite. */ private void initToolbar(final Composite composite) { Display display = composite.getDisplay(); ClassLoader loader = getClass().getClassLoader(); // Instantiate toolbar. ToolBar toolBar = new ToolBar(composite, SWT.BORDER); // Instantiate images. imgRefresh = new Image(display, loader.getResourceAsStream("toolbar/refresh.png")); imgAdd = new Image(display, loader.getResourceAsStream("toolbar/add.png")); imgDelete = new Image(display, loader.getResourceAsStream("toolbar/delete.png")); imgClone = new Image(display, loader.getResourceAsStream("toolbar/clone.png")); imgUpload = new Image(display, loader.getResourceAsStream("toolbar/upload.png")); imgAddField = new Image(display, loader.getResourceAsStream("toolbar/add_field.png")); imgClear = new Image(display, loader.getResourceAsStream("toolbar/clear.png")); imgCommit = new Image(display, loader.getResourceAsStream("toolbar/commit.png")); imgOptimize = new Image(display, loader.getResourceAsStream("toolbar/optimize.png")); imgExport = new Image(display, loader.getResourceAsStream("toolbar/export.png")); imgBackup = new Image(display, loader.getResourceAsStream("toolbar/backup.png")); imgRestore = new Image(display, loader.getResourceAsStream("toolbar/restore.png")); // Instantiate buttons. itemRefresh = new ToolItem(toolBar, SWT.PUSH); itemRefresh.setImage(imgRefresh); itemRefresh.setText("Refresh"); itemRefresh.setToolTipText("Refresh from Solr: this will wipe out local modifications"); itemRefresh.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { try { table.refresh(); } catch (SophieException e) { ExceptionDialog.open(composite.getShell(), new SophieException("Unable to refresh documents from Solr server", e)); } } }); new ToolItem(toolBar, SWT.SEPARATOR); itemAdd = new ToolItem(toolBar, SWT.PUSH); itemAdd.setImage(imgAdd); itemAdd.setText("Add"); itemAdd.setToolTipText("Add new document"); itemAdd.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { table.addDocument(new SolrDocument()); } }); itemDelete = new ToolItem(toolBar, SWT.PUSH); itemDelete.setImage(imgDelete); itemDelete.setText("Delete"); itemDelete.setToolTipText("Delete document"); itemDelete.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { table.deleteSelectedDocument(); } }); itemDelete.setEnabled(false); itemClone = new ToolItem(toolBar, SWT.PUSH); itemClone.setImage(imgClone); itemClone.setText("Clone"); itemClone.setToolTipText("Clone document"); itemClone.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { SolrDocument document = table.getSelectedDocument(); if (document == null) { return; } // Unset the unique key field so we don't have two rows // describing the same Solr document. try { String uniqueKey = SolrUtils.getRemoteUniqueField(); document.removeFields(uniqueKey); } catch (SophieException e) { Sophie.log.warn("Unable to unset unique key on cloned document"); } // Add cloned document. table.addDocument(document); } }); itemClone.setEnabled(false); itemUpload = new ToolItem(toolBar, SWT.PUSH); itemUpload.setImage(imgUpload); itemUpload.setText("Upload"); itemUpload.setToolTipText("Upload local modifications to Solr"); itemUpload.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { try { table.upload(); } catch (SophieException e) { ExceptionDialog.open(composite.getShell(), new SophieException("Unable to upload local modifications to Solr", e)); } } }); itemUpload.setEnabled(false); new ToolItem(toolBar, SWT.SEPARATOR); itemAddField = new ToolItem(toolBar, SWT.PUSH); itemAddField.setImage(imgAddField); itemAddField.setText("Add field"); itemAddField.setToolTipText("Add new field"); itemAddField.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { // Get field schema fields. Map<String, FieldInfo> fields; try { fields = SolrUtils.getRemoteSchemaFields(); } catch (SophieException e) { ExceptionDialog.open(composite.getShell(), new SophieException("Unable to fetch schema fields", e)); return; } // Remove universal pattern which is not useful and will match // any field name. fields.remove("*"); // Remove fields already displayed in the table. Collection<String> excludedFieldNames = table.getFieldNames(); for (String existingFieldName : excludedFieldNames) { fields.remove(existingFieldName); } // Extract and sort field names. Set<String> fieldNames = fields.keySet(); String[] fieldNamesArray = new String[fieldNames.size()]; fieldNames.toArray(fieldNamesArray); Arrays.sort(fieldNamesArray); // Prompt user for new field name. FieldValidator validator = new FieldValidator(fields, excludedFieldNames); CComboDialog dialog = new CComboDialog(composite.getShell(), "Add new field", "Field name:", fieldNamesArray, validator); dialog.open(); if (dialog.getReturnCode() != IDialogConstants.OK_ID) { return; } // Add new field. String fieldName = dialog.getValue(); FieldInfo field = validator.getMatchingField(fieldName); table.addField(fieldName, field); } }); itemClear = new ToolItem(toolBar, SWT.PUSH); itemClear.setImage(imgClear); itemClear.setText("Clear"); itemClear.setToolTipText("Clear index"); itemClear.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { MessageBox messageBox = new MessageBox(composite.getShell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO); messageBox.setText("Clear index"); messageBox.setMessage( "Do you really want to clear the index? This will remove all documents from the index."); int response = messageBox.open(); if (response == SWT.YES) { try { Sophie.client.deleteByQuery("*:*"); Sophie.client.commit(); table.refresh(); } catch (SolrServerException | IOException | SolrException | SophieException e) { ExceptionDialog.open(composite.getShell(), new SophieException("Unable to clear index", e)); } } } }); itemCommit = new ToolItem(toolBar, SWT.PUSH); itemCommit.setImage(imgCommit); itemCommit.setText("Commit"); itemCommit.setToolTipText("Commit index"); itemCommit.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { try { Sophie.client.commit(); table.refresh(); } catch (SolrServerException | IOException | SolrException | SophieException e) { ExceptionDialog.open(composite.getShell(), new SophieException("Unable to commit index", e)); } } }); itemOptimize = new ToolItem(toolBar, SWT.PUSH); itemOptimize.setImage(imgOptimize); itemOptimize.setText("Optimize"); itemOptimize.setToolTipText("Optimize index"); itemOptimize.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { MessageBox messageBox = new MessageBox(composite.getShell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO); messageBox.setText("Optimize index"); messageBox.setMessage( "Do you really want to optimize the index? If the index is highly segmented, this may take several hours and will slow down requests."); int response = messageBox.open(); if (response == SWT.YES) { try { Sophie.client.optimize(); // Optimizing drops obsolete documents, obsolete facet // values, etc so we need to refresh the table. table.refresh(); } catch (SolrServerException | IOException | SolrException | SophieException e) { ExceptionDialog.open(composite.getShell(), new SophieException("Unable to optimize index", e)); } } } }); new ToolItem(toolBar, SWT.SEPARATOR); itemExport = new ToolItem(toolBar, SWT.PUSH); itemExport.setImage(imgExport); itemExport.setText("Export"); itemExport.setToolTipText("Export as CSV file"); itemExport.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { try { table.export(); } catch (SophieException e) { ExceptionDialog.open(composite.getShell(), e); } } }); itemBackup = new ToolItem(toolBar, SWT.PUSH); itemBackup.setImage(imgBackup); itemBackup.setText("Backup"); itemBackup.setToolTipText("Make a backup of the index"); itemBackup.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { InputDialog dialog = new InputDialog(composite.getShell(), "Make a backup of the index", "Backup name (leave empty to use a timestamp):", null, null); dialog.open(); if (dialog.getReturnCode() != IDialogConstants.OK_ID) { return; } String backupName = dialog.getValue(); ModifiableSolrParams params = new ModifiableSolrParams(); params.set("command", "backup"); params.set("name", backupName); QueryRequest request = new QueryRequest(params); request.setPath("/replication"); try { NamedList<Object> response = Sophie.client.request(request); // org.apache.solr.handler.ReplicationHandler.OK_STATUS is // "OK". if (StringUtils.equals(response.get("status").toString(), "OK")) { MessageBox messageBox = new MessageBox(composite.getShell(), SWT.ICON_INFORMATION | SWT.OK); messageBox.setText("Backup started"); messageBox.setMessage( "Backup started and will be saved into Solr data directory under the name \"snapshot." + (StringUtils.isEmpty(backupName) ? "<timestamp>" : backupName) + "\"."); messageBox.open(); } else { MessageBox messageBox = new MessageBox(composite.getShell(), SWT.ICON_ERROR | SWT.OK); messageBox.setText("Backup error"); messageBox.setMessage("Unable to backup the index."); messageBox.open(); } } catch (SolrServerException | IOException | SolrException e) { ExceptionDialog.open(composite.getShell(), new SophieException("Unable to create backup \"" + backupName + "\"", e)); } } }); itemRestore = new ToolItem(toolBar, SWT.PUSH); itemRestore.setImage(imgRestore); itemRestore.setText("Restore"); itemRestore.setToolTipText("Restore index from a backup"); itemRestore.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { // Restoring a backup requires Solr >=5.2 // @see SOLR-6637 InputDialog dialog = new InputDialog(composite.getShell(), "Restore index from a backup", "Note: backup restoration requires Solr >= 5.2.\n\nBackup name (leave empty to pick the latest backup available):", null, null); dialog.open(); if (dialog.getReturnCode() != IDialogConstants.OK_ID) { return; } try { table.restore(dialog.getValue()); } catch (SophieException e) { ExceptionDialog.open(composite.getShell(), e); } } }); // Pack. toolBar.pack(); }
From source file:com.manydesigns.portofino.pageactions.crud.CrudAction4ItsProject.java
/** * Returns a XSLT stream by searching for a file first in this action's directory, then at the root of the * classpath.//from ww w . ja v a 2s .c om * * @param templateFop the file to search for * @return the stream */ protected InputStream getXsltStream(String templateFop) { // hongliangpan change dir ? webapp\WEB-INF\pages\t_customer webapp\WEB-INF File dir = pageInstance.getDirectory(); String rootPath = "WEB-INF"; if (dir.getPath().indexOf(rootPath) > 0) { dir = new File(dir.getPath().substring(0, dir.getPath().indexOf(rootPath) + 8)); } File fopFile = new File(dir, templateFop); if (fopFile.exists()) { logger.debug("Custom FOP template found: {}", fopFile); try { return new FileInputStream(fopFile); } catch (FileNotFoundException e) { throw new Error(e); } } else { logger.debug("Using default FOP template: {}", templateFop); ClassLoader cl = getClass().getClassLoader(); return cl.getResourceAsStream(templateFop); } }
From source file:com.atypon.wayf.guice.WayfGuiceModule.java
@Override protected void configure() { try {// ww w . j a v a 2s . com ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); Properties properties = new Properties(); String configDirectory = System.getProperty("wayf.conf.dir"); if (configDirectory != null) { String configFile = configDirectory + "/" + WAYF_CONFIG_FILE; LOG.info("Loading wayf config file from location [{}]", configFile); FileReader reader = new FileReader(configFile); properties.load(reader); } else { LOG.info("Loading wayf config file from classpath"); properties.load(classLoader.getResourceAsStream(WAYF_CONFIG_FILE)); } properties.load(classLoader.getResourceAsStream("dao/device-access-dao-db.properties")); properties.load(classLoader.getResourceAsStream("dao/publisher-dao-db.properties")); properties.load(classLoader.getResourceAsStream("dao/device-dao-db.properties")); properties.load(classLoader.getResourceAsStream("dao/open-athens-entity-dao-db.properties")); properties.load(classLoader.getResourceAsStream("dao/oauth-entity-dao-db.properties")); properties.load( classLoader.getResourceAsStream("dao/device-identity-provider-blacklist-dao-db.properties")); properties.load(classLoader.getResourceAsStream("dao/authorization-token-dao-db.properties")); properties.load(classLoader.getResourceAsStream("dao/error-logger-dao-db.properties")); properties.load(classLoader.getResourceAsStream("dao/publisher-registration-dao-db.properties")); properties.load(classLoader.getResourceAsStream("dao/user-dao-db.properties")); properties.load(classLoader.getResourceAsStream("dao/password-credentials-dao-db.properties")); properties.load(classLoader.getResourceAsStream("dao/external-id-dao-db.properties")); Names.bindProperties(binder(), properties); bind(DeviceIdentityProviderBlacklistFacade.class).to(DeviceIdentityProviderBlacklistFacadeImpl.class); bind(IdentityProviderUsageFacade.class).to(IdentityProviderUsageFacadeImpl.class); bind(CryptFacade.class).to(CryptFacadeBcryptImpl.class); bind(CacheManager.class).to(CacheManagerImpl.class); bind(PasswordCredentialsFacade.class).to(PasswordCredentialsFacadeImpl.class); bind(PasswordCredentialsDao.class).to(PasswordCredentialsDaoDbImpl.class); bind(AuthorizationTokenFacade.class).to(AuthorizationTokenFacadeImpl.class); bind(AuthorizationTokenFactory.class).to(AuthorizationTokenFactoryImpl.class); bind(new TypeLiteral<AuthenticationCredentialsDao<PasswordCredentials>>() { }).to(PasswordCredentialsDaoDbImpl.class); bind(new TypeLiteral<AuthenticationCredentialsDao<AuthorizationToken>>() { }).to(AuthorizationTokenDaoDbImpl.class); bind(AuthenticationFacade.class).to(AuthenticationFacadeImpl.class); bind(DeviceAccessFacade.class).to(DeviceAccessFacadeImpl.class); bind(DeviceAccessDao.class).to(DeviceAccessDaoDbImpl.class); bind(DeviceFacade.class).to(DeviceFacadeImpl.class); bind(DeviceDao.class).to(DeviceDaoDbImpl.class); bind(UserFacade.class).to(UserFacadeImpl.class); bind(UserDao.class).to(UserDaoDbImpl.class); bind(PublisherFacade.class).to(PublisherFacadeImpl.class); bind(PublisherDao.class).to(PublisherDaoDbImpl.class); bind(PublisherRegistrationDao.class).to(PublisherRegistrationDaoDbImpl.class); bind(PublisherRegistrationFacade.class).to(PublisherRegistrationFacadeImpl.class); bind(IdentityProviderFacade.class).to(IdentityProviderFacadeImpl.class); bind(IdpExternalIdFacade.class).to(IdpExternalIdFacadeImpl.class); bind(IdPExternalIdDao.class).to(IdPExternalIdDaoImpl.class); bind(ErrorLoggerFacade.class).to(ErrorLoggerFacadeImpl.class); bind(ErrorLoggerDao.class).to(ErrorLoggerDaoDbImpl.class); bind(new TypeLiteral<InflationPolicyParser<String>>() { }).to(InflationPolicyParserQueryParamImpl.class); bind(DeviceIdentityProviderBlacklistDao.class).to(DeviceIdentityProviderBlacklistDaoDbImpl.class); bind(ClientJsFacade.class).to(ClientJsFacadeImpl.class); bind(MailMessageSender.class).to(DefaultMailMessageSender.class); } catch (Exception e) { LOG.error("Error initializing Guice", e); throw new RuntimeException(e); } }
From source file:org.atomspace.pi2c.runtime.Server.java
/** * Loading Jars with the ClassLoader and Unzip the included Jar-Files from libs folder * @throws SecurityException// ww w. ja v a 2 s . com * @throws NoSuchMethodException * @throws IOException * @throws IllegalArgumentException * @throws IllegalAccessException * @throws InvocationTargetException */ private void loadingJars() throws SecurityException, NoSuchMethodException, IOException, IllegalArgumentException, IllegalAccessException, InvocationTargetException { // Prepair Classloader Reflextion Method m = URLClassLoader.class.getDeclaredMethod("addURL", new Class[] { URL.class }); m.setAccessible(true); ClassLoader cl = Server.class.getClassLoader(); // Create Temp Dir File appTmp = new File(System.getProperty("java.io.tmpdir") + "/" + location.toString().substring(location.toString().lastIndexOf("/"))); System.err.println("::: use temporary dir path '" + appTmp.getAbsolutePath() + "'"); if (!appTmp.exists()) { appTmp.mkdir(); } ZipInputStream zip = new ZipInputStream(location.openStream()); ZipEntry entry = zip.getNextEntry(); while (entry != null) { if (entry.getName().startsWith("libs/") && entry.getName().endsWith(".jar") || (entry.getName().endsWith("MANIFEST.MF"))) { System.err.println("::: " + new Date() + " ::: Extracting " + entry.getName() + " :::"); InputStream is = cl.getResourceAsStream(entry.getName()); File tmpJar = new File(appTmp + "/" + entry.getName().substring(entry.getName().lastIndexOf("/"))); unzip(is, tmpJar); m.invoke(cl, new Object[] { tmpJar.toURI().toURL() }); } else { System.err.println("::: " + new Date() + " ::: ignore " + entry.getName() + " :::"); } entry = zip.getNextEntry(); } }