meta-inf

Removing a jar files META-INF folder in Java

家住魔仙堡 提交于 2020-02-04 14:41:02
问题 I am using the following method to filter out META-INF folder and its contents: public static void copyWithoutMetaInf(final String originalZip, final String newZip) throws IOException { final ZipInputStream zip = new ZipInputStream(new FileInputStream(originalZip)); final ZipOutputStream zop = new ZipOutputStream(new FileOutputStream(newZip)); ZipEntry entry; while((entry = zip.getNextEntry()) != null) { if(!entry.getName().contains("META-INF")) { zop.putNextEntry(entry); } } zip.close(); zop

how to load a properties file from the META-INF directory?

核能气质少年 提交于 2020-01-05 04:12:09
问题 Is it correct to say that properties files used in execution by a running JAR best belong in META-INF ? The notion being to fit with the Standard Directory Layout specified by Maven . Assuming that structure is desired, how is the properties file loaded from META-INF ? thufir@doge:~/NetBeansProjects/json_parser$ thufir@doge:~/NetBeansProjects/json_parser$ java -jar build/libs/json_parser-all.jarAug 18, 2017 6:44:24 AM net.bounceme.doge.json.Main main INFO: starting Aug 18, 2017 6:44:24 AM net

Using serviceloader on android

和自甴很熟 提交于 2019-12-28 02:05:28
问题 I am very new to java and android development and to learn I am trying to start with an application to gather statistics and information like munin does. I am trying to be able to load "plugins" in my application. These plugins are already in the application but I don't want to have to invoke them all separately, but be able to iterate over them. I was trying to use serviceloader but could never get the META-INF/services into my apk. So I am wondering if it is possible to use serviceloader on

JPA: configure persistence provider

天涯浪子 提交于 2019-12-25 11:57:03
问题 I got a simple java project created with maven (quickstart archetype) I am trying to configure JPA persistence for drools sessions (the code comes from drools documentation) I added drools-persistence-jpa, Bitronix Transaction Manager and com.h2database dependencies to my pom.xml I created a META-INF folder as Source-Folder in my Eclipse Project in "src/META-INF" I added the persistence.xml and jndi.properties file there. In my TestCase I have following code: [...] EntityManagerFactory emf =

META-INF/version duplicate error when using Proguard

[亡魂溺海] 提交于 2019-12-23 13:21:12
问题 Gradle : 4.10.1 Gradle Android Plugin version : 3.3.2 Proguard : 6.0.3 JDK - 1.9 Android Studio 3.3.2 When I try to build apk release version along with Proguard. I get the following error - Caused by: java.io.IOException: Please correct the above warnings first. at proguard.InputReader.execute(InputReader.java:149) at proguard.ProGuard.readInput(ProGuard.java:255) at proguard.ProGuard.execute(ProGuard.java:96) ...... This seems to be caused due to this - Warning: class [META-INF/versions/9

Two Meta-Inf folders - normal structure?

╄→尐↘猪︶ㄣ 提交于 2019-12-21 05:09:17
问题 I just "discovered" that we have two Meta-Inf folders ... In eclipse and also in the War file. The First one is (in the war): /META-INF/ The Second, and weird one ist: /WEB-INF/classes/META-INF/ In the second folder is a persistance.xml and a something.taglib.xml... If i move the files into the first meta-inf folder i get exceptions from hibernate.. What is the purpose of this second and oddly placed meta-inf folder ? Is this a normal folder structure ? 回答1: The "weird one" location is

How to read properties file from meta-inf folder from a POJO

浪尽此生 提交于 2019-12-14 03:59:37
问题 How to read properties file from meta-inf folder in a web application from plain java class. 回答1: The simplest you can do is :- InputStream propertiesIs = this.getClass().getClassLoader().getResourceAsStream("META-INF/your.properties"); Properties prop = new Properties(); prop.load(propertiesIs); System.out.println(prop.getProperty(YourPropertyHere)); OR you can try loading your properties using FileInputStream also :- input = new FileInputStream("META-INF/your.properties"); 回答2: package net