jar

Java how to read folder and list files in that folder in jar environment instead of IDE

只谈情不闲聊 提交于 2020-01-10 02:03:35
问题 my problem is that I create a folder(name is IconResources) under src , in IconResources there are many pictures. Directory is like this: ProjectName src package 1 package 2 IconResources(this is the target folder) I want to list all picture files name and do something with those pictures. And I found that File.list() only works in IDE, if I export project to a jar to make a standalone, it cannot work. So I searched and found that I should use inputstream and outputstream. Now I find i/o

apache spark: akka version error by build jar with all dependencies

☆樱花仙子☆ 提交于 2020-01-09 22:16:45
问题 i have build a jar file from my spark app with maven (mvn clean compile assembly:single) and the following pom file: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>mgm.tp.bigdata</groupId> <artifactId>ma-spark</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <name>ma

apache spark: akka version error by build jar with all dependencies

强颜欢笑 提交于 2020-01-09 22:11:29
问题 i have build a jar file from my spark app with maven (mvn clean compile assembly:single) and the following pom file: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>mgm.tp.bigdata</groupId> <artifactId>ma-spark</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <name>ma

Only create executable jar-with-dependencies in Maven

允我心安 提交于 2020-01-09 19:39:35
问题 In my pom.xml I use the maven-assembly-plugin to create an executable jar-with-dependencies when running "mvn clean install". Now it first creates the non-executable "name-version.jar" and after that the "name-version-jar-with-dependencies.jar". Can I configure the pom.xml somehow, so that it doesn't create the non-executable JAR file? At the moment I use <appendAssemblyId>false</appendAssemblyId> so it just overwrites the first file... Also I get several "... already added, skipping"

NO opencv_java300 in java.library.path [duplicate]

独自空忆成欢 提交于 2020-01-09 19:31:55
问题 This question already has answers here : UnsatisfiedLinkError: no opencv_java249 in java.library.path (8 answers) Closed 3 years ago . Thanks in advance.. I have a project that uses opencv-300.jar as external library. I have tried this in eclipse and in natBeans. In both it is working successfully when I am running my project from IDE itself. I want my project to export it as a runnable (or executable) jar. I placed my opencv_java300.dll file in source folder with main java file and given its

NO opencv_java300 in java.library.path [duplicate]

自闭症网瘾萝莉.ら 提交于 2020-01-09 19:31:29
问题 This question already has answers here : UnsatisfiedLinkError: no opencv_java249 in java.library.path (8 answers) Closed 3 years ago . Thanks in advance.. I have a project that uses opencv-300.jar as external library. I have tried this in eclipse and in natBeans. In both it is working successfully when I am running my project from IDE itself. I want my project to export it as a runnable (or executable) jar. I placed my opencv_java300.dll file in source folder with main java file and given its

Read directory inside JAR with InputStreamReader

孤人 提交于 2020-01-09 10:28:28
问题 So, this question has been asked a million times i believed and I've been reading them for a couple of hours and trying several options given by some people but none of them work for me. I want to list all the files inside a directory inside the application's JAR, so in IDE this works: File f = new File(this.getClass().getResource("/resources/").getPath()); for(String s : f.list){ System.out.println(s); } That gives me all the files inside the directory. Now, i've tried this also: InputStream

How can I start apache derby programmatically jar file?

流过昼夜 提交于 2020-01-09 08:11:09
问题 I have a Java application, which uses Apache Derby. Using Eclipse Export option, I exported it as JAR file. When I am running Eclipse, and the server is connected to port 1527, the JAR executes correctly. However when eclipse is closed, (and the server is not connected to 1527) on executing jar, i get this error java.sql.SQLNonTransientConnectionException: java.net.ConnectException : Error connecting to server localhost on port 1527 with message Connection refused. This is understandable. But

Simpliest way to add an attribute to a jar Manifest in Maven

一笑奈何 提交于 2020-01-09 07:34:07
问题 Since the last Java update, I need to tag my applet jars manifest with the Trusted-Library attribute to avoid warning popup when javascript is communicating with the applet. (see http://docs.oracle.com/javase/7/docs/technotes/guides/jweb/mixed_code.html) Manifest-Version: 1.0 Trusted-Library: true Created-By: 1.6.0-internal (Sun Microsystems Inc.) I never done such things before, is there a plugin which allow to do that in a seamless way or should I write one, or use the ant plugin? The jars

reading MANIFEST.MF file from jar file using JAVA

怎甘沉沦 提交于 2020-01-09 04:39:08
问题 Is there any way i can read the contents of a jar file. like i want to read the manifest file in order to find the creator of the jar file and version. Is there any way to achieve the same. 回答1: Next code should help: JarInputStream jarStream = new JarInputStream(stream); Manifest mf = jarStream.getManifest(); Exception handling is left for you :) 回答2: You could use something like this: public static String getManifestInfo() { Enumeration resEnum; try { resEnum = Thread.currentThread()