jar

Problems to access a report in a jar file

大兔子大兔子 提交于 2020-01-23 01:32:05
问题 I have a jar application that contains several reports (files .jasper ) and the way that I get the path of the report is: getClass().getResource("/reportes/mireporte.jasper").toString(); but when I execute I get the next error: FileNotFoundException although the report is within the jar file when I open it with the winrar. My questions are: Is this the way to get the path of a report in a jar files? Is it possible to open reports that are within of a jar file? 回答1: Why are you converting the

Creating UTF-8 files in Java from a runnable Jar

☆樱花仙子☆ 提交于 2020-01-22 20:42:06
问题 I have a little Java project where I've set the properties of the class files to UTF-8 (I use a lot of foreign characters not found on the default CP1252). The goal is to create a text file (in Windows) containing a list of items. When running the class files from Eclipse itself (hitting Ctrl+F11) it creates the file flawlessly and opening it in another editor (I'm using Notepad++) I can see the characters as I wanted. ┌──────────────────────────────────────────────────┐ │ Universidade2010

Maven. Put .DLL in the root of JAR

坚强是说给别人听的谎言 提交于 2020-01-22 18:57:23
问题 How I can include native .dll file in root of JAR using Maven? 回答1: If you already have your .dll file just store it in your project's src/main/resources directory and Maven will put it in the target jar's root directory. 回答2: You can see these links may it helps.. how to make a jar file that include dll files How to add native library to “java.library.path” with Eclipse launch (instead of overriding it) native_loader 来源: https://stackoverflow.com/questions/12157783/maven-put-dll-in-the-root

SBT assembly jar exclusion

*爱你&永不变心* 提交于 2020-01-22 05:51:33
问题 Im using spark (in java API) and require a single jar that can be pushed to the cluster, however the jar itself should not include spark. The app that deploys the jobs of course should include spark. I would like: sbt run - everything should be compiled and excuted sbt smallAssembly - create a jar without spark sbt assembly - create an uber jar with everything (including spark) for ease of deployment. I have 1. and 3. working. Any ideas on how I can 2. ? What code would I need to add to my

Load my own Xalan implementation where an older Xalan is loaded to the parent classloader

别等时光非礼了梦想. 提交于 2020-01-22 02:24:07
问题 I'm writing a plugin for a framework that loads my code as a child classloader The problem is that that framework uses a certain Xerces version, that is not compatible with my code, I want to use my "own" jar for xerces, but it seems since the old one was already loaded, I can't seem to make my code use mine. I'm looking for some classloader seperation, I know it's a know problem, but can't seem to solve it Is there any framework, library, or code sample to user locally a newer jar in such a

Where should I put an external JAR file in my Eclipse project?

落爺英雄遲暮 提交于 2020-01-21 15:27:27
问题 I've created a new project in Eclipse and I want to include the ANTLR jar file. Where do you typically place your jar files before referencing them in your project? Do you create a "Source Directory" in eclipse, or a normal "Directory"? Do you then reference them from there? I want to be able to easily transport this project around and not declare references to jar files outside my projects folder but I'm not sure what the normal convention is to do in the Java world. Any guidance would be

It is possible to include layout and other resources in an Android jar?

試著忘記壹切 提交于 2020-01-21 12:06:10
问题 I'm building a jar so that other developers can use the view I create in their Android applications. I'm wondering if it is possible to use a layout resource in my jar so I can build the layout of my view or if I need to build up my view programmatically. Similarly, can I include image resources in my jar file? 回答1: No, not currently. Because of the way Android packages resources in an apk, you can't include them in a jar. However, you can still share the jar with the other developers - they

Running .jar file - Double click vs. command line execution

雨燕双飞 提交于 2020-01-21 10:04:46
问题 I have a java desktop application that contains the following code: JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); System.out.println("check1"); int intResult = compiler.run(System.in, System.out, foutErrorFile, strvalidatePath); System.out.println("check2"); When I run the corresponding .jar file of this application by executing "java -jar name.jar", both check1 and check2 gets printed and app works fine. But when i try to run the jar by double clicking the .jar file, I found

Read a file from inside of an external Jar file?

烈酒焚心 提交于 2020-01-21 05:53:05
问题 I'm trying to read a file from inside an external jar using java.. For example, I have two jar files. One is "foo.jar" the other is "bar.jar". Inside of "bar.jar" is the file "foo-bar.txt". How do i read the file "foo-bar.txt" from inside of "bar.jar" using code in "foo.jar"...? Is this even possible..? I know that i can read a file from iside of foo.jar using this.getClass().getClassLoader().getResourceAsStream("foo-bar.txt"); But I don't know how to do it from an external jar.. can someone

Read a file from inside of an external Jar file?

可紊 提交于 2020-01-21 05:52:08
问题 I'm trying to read a file from inside an external jar using java.. For example, I have two jar files. One is "foo.jar" the other is "bar.jar". Inside of "bar.jar" is the file "foo-bar.txt". How do i read the file "foo-bar.txt" from inside of "bar.jar" using code in "foo.jar"...? Is this even possible..? I know that i can read a file from iside of foo.jar using this.getClass().getClassLoader().getResourceAsStream("foo-bar.txt"); But I don't know how to do it from an external jar.. can someone