jar

Create a JAR containing classes and resources from webapp using Gradle

谁说胖子不能爱 提交于 2020-01-03 09:04:20
问题 I would like to create a jar from the contents of a WAR using gradle. The result I want is quite like what the archiveClasses = true setting of maven-war-plugin does. I understand that the gradle war plugin doesn't seem to do this (as per this stackoverflow question). Is there a way to do this manually? Say by manipulating the gradle jar task to collect the required parts from the WEB-INF folder? When I just use the default jar task it doesn't get the resources from the WEB-INF directory. The

Call a method of running jar from batch

青春壹個敷衍的年華 提交于 2020-01-03 06:27:14
问题 i have a Java application, which's main-function is called from a batch file witch 2 parameters. Now i want to pass another pair of parameters to the same app and not open another instance. Is it possible to call the main-function (or any other) of a running jar file from outside? Thank you for your help! 回答1: You should probably do this using JMX, as I mentioned in my comment. JMX allows you to expose "management beans" from you program that can then be invoked remotely. Lets start with a

Maven installing 3rd party Jar file

左心房为你撑大大i 提交于 2020-01-03 05:34:09
问题 I am using apache maven 3.1.1. I was trying to install a 3rd party Jar file in my local repository using the following command mvn install:install-file -Dfile=<path-to-file> However, I am getting an error saying there is no Pom file in the current directory where the maven is ran from. According to Maven install plug-in if the jar file is created using Maven it will have POM xml in it (and in this case the POM is there in the jar file in a sub-dir of META-INF) and you will not need to supply

Runnable jar runs fine with java -jar, but problems with double-click

故事扮演 提交于 2020-01-03 05:04:07
问题 I am using the eclipse IDE and I just exported my project using 'export->Runnable Jar'. In my code, I have loaded a map using URL map1url = this.getClass().getResource("map01.txt"); and later inputmap = new File(map1url.getFile()); and then scanned its data using Scanner sc = null; try { sc = new Scanner(inputmap); } catch (FileNotFoundException e) { e.printStackTrace(); } Now, when I package the map01.txt into the jar, and double click it, it runs, but can't find the map01.txt. When I use

hadoop jar command points to local filesystem

十年热恋 提交于 2020-01-03 04:35:09
问题 I have a valid jar which is running perfectly on another system running the same version of hadoop i.e hadoop-1.2.1 with the same settings. I am able to put the jar file in the hdfs filesystem and create input,output directories. But when I use the command 'hadoop jar HelloWorld.jar classname(main method) input output' it throws 'Invalid jar' error. After searching for the possible solutions for a long time I found out that the command is searching for the jar in local filesystem instead of

Is there a better solution than CSS sprites?

南笙酒味 提交于 2020-01-03 02:22:34
问题 this is not a question about a specific programming problem, it's about examining different concepts. If the moderators don't feel this is ok, delete my question. I need to display 100 png images in a table td, and the images are 75x16 PNGs. In order to reduce the number of HTTP requests, I grouped all 166 images (only roughly 100 are shown at one time) in a big spritesheet, and have used the IMG tag to display the output, one image at a time. This is the code: CSS: .sprites {background-image

Creating jarFile to use Instrumentation for calculating Memory usage of an object in Eclipse

你说的曾经没有我的故事 提交于 2020-01-03 02:01:24
问题 I want to calculate the memory usage of my object with help of instrumentation class. I found the this page as a straightforward instruction but I do not know how create a jar file in eclipse with the following setting. Where should I mention these setting during exporting JAR file in eclipse? jar -cmf manifest.txt agent.jar mypackage/MyAgent.class To answer question of @Rodrigo Ribeiro; I try to compile my code through command prompt with command javac MyAgent.java but I got the following

Calling same Method having same packageName From Different JARs [duplicate]

孤人 提交于 2020-01-03 01:44:08
问题 This question already has answers here : Java, Classpath, Classloading => Multiple Versions of the same jar/project (5 answers) Closed 5 years ago . I have three Jar files.All jar files contain Same class TestServicesImpl And Same Method displayWeLcomeMessage() But having different messages(output) of displayWeLcomeMessage(). Example : public void displayWeLcomeMessage() { System.out.println("wecome msg of JAR version first"); } public void displayWeLcomeMessage() { System.out.println("wecome

Library (jar) dependencies between github repositories

眉间皱痕 提交于 2020-01-02 23:58:29
问题 I can't figure out an appropriate way to structure git repositories to handle library dependencies between git repositiories. I have a number of Java projects that rely on another, frequently updated project that's included in them as a .jar library. I now want to migrate them all to github. Can I set up the projects in github so that whenever I push project A, then all other projects can pull the new version of projectA.jar automagically? They don't rely on any source files, they just need

Jar files: why does extracting then compression a jar file create a file of a different size to the original?

强颜欢笑 提交于 2020-01-02 23:27:00
问题 I was trying to edit a single byte in an extracted Eclipse plugin jar file. I noticed that after I re-compressed the files as a jar, the resultant file was larger than the original (only 1%) and that the plugin didn't work. Eclipse booted, but shut down silently after selecting a workspace. Rolling back to the original plugin allowed it to start successfully. I then tried uncompressing, then compressing the plugin (not changing anything) and the resultant jar file was still bigger than the