Questions tagged [onejar]

One-JAR lets developer package a Java application together with its dependency Jars into a single executable Jar file.

One-JAR provides custom classloader that knows how to load classes and resources from a jars inside an archive, instead of from jars in the filesystem. It discovers dependency jar files based on the internal structure of the archive, there is no custom code required to do this. One-JAR archives can be constructed using Ant or Maven2. Application can be run using command: java -jar my-app.jar.

67 questions
10
votes
3 answers

How to set additional Class-Path entries in manifest with onejar Maven plugin?

Is there a way to add an arbitrary classpath entry to a JAR file manifest using onejar-maven-plugin? I found the way to configure maven-jar-plugin to do this, but it appears that there is no such option for onejar-maven-plugin. This is not done to…
Gene M
  • 1,136
  • 1
  • 10
  • 16
8
votes
2 answers

Embed Tomcat with App in One Fat Jar

I was hoping to combine/embed Tomcat and my web app as onejar aka fat jar but I'm not sure if its possible. Its possible with Jetty using the Maven Shade plugin and Winstone but I tried something similar with Tomcat 7 and could not get it to load…
Adam Gent
  • 47,843
  • 23
  • 153
  • 203
8
votes
1 answer

OneJar and dynamic class loading

We're currently investigating the use of OneJar in our application (for a number reasons), but our application makes use of a number of custom URLClassloaders to load application extensions. When bundled as a "OneJar" Jar, we get ClassNotFound…
MadProgrammer
  • 343,457
  • 22
  • 230
  • 366
7
votes
2 answers

Why would ClassLoader.getResourceAsStream() return null?

Having the following code broken deliberately to identify the source of a NullPointerException in something that should have been very simple but turns out to drive me nuts: Properties properties = new Properties(); Thread currentThread =…
Withheld
  • 4,603
  • 10
  • 45
  • 76
6
votes
2 answers

Maven Java application crashes when running from command line but not from within the Netbeans IDE

Edit: Question Rewritten: I created a new minimal example to illustrate my problem. First here is the source code of a simple class App.java: package testlog4j.testlog4j; import java.io.*; import java.net.*; import org.apache.log4j.*; import…
mtleis
  • 712
  • 1
  • 9
  • 28
5
votes
1 answer

How use Java ServiveLocator with One-Jar

I'm packaging an application of mine in a single jar using the One-Jar tool: http://one-jar.sourceforge.net/ It works nike, but I have a problem with a service implemented in a dependency module, which is implemented in a separate jar. The module…
pditommaso
  • 3,186
  • 6
  • 28
  • 43
4
votes
1 answer

How to really & fully exclude a package from a jar?

Having this dependencies section in my pom.xml: junit junit 3.8.1 test
Withheld
  • 4,603
  • 10
  • 45
  • 76
4
votes
3 answers

Classpath resources inside one-jar packaged via sbt

I have a project that is build using SBT which packages a single jar using the one-jar plugin. That project contains a bunch of json files in src/main/resources/fixture which I used to access via new…
reikje
  • 2,850
  • 2
  • 24
  • 44
4
votes
1 answer

Renaming jar files with sbt when using SbtOneJar

When sbt builds a OneJar file using the SbtOneJar plugin it gives the built jar the name [name]_[scala-version]-[version]-one-jar.jar where name is the name of the project, scala-version is the scalaVersion and version is the version of the project,…
C R
  • 2,182
  • 5
  • 32
  • 41
3
votes
1 answer

Gradle: How to use one-jar output as input for launch4j

I'd like to create a exe file, without having to put all required libraries beside the exe. Formerly with ant I created a self-contained jar file with one-jar and then wrapped this into a exe file with launch4j. Gradle has plugins for both and…
peez80
  • 1,583
  • 2
  • 15
  • 32
3
votes
4 answers

Is there a way to automatically package multiple main classes in the same SBT project with sbt-onejar?

I have an SBT project that contains multiple classes with main, i.e. MyClass extends App. One-jar works fine when there is only one such class. If it finds multiple classes it prompts me to choose which one I want to package: > one-jar Multiple…
yǝsʞǝla
  • 16,272
  • 2
  • 44
  • 65
3
votes
1 answer

Signing jar created with onejar-maven-plugin throwing stackoverflow exception

I have a jar which is created using onejar-maven-plugin, which is meant to listen to jms messages from tibco and process accordingly. It works fine but when I sign this jar using jarsigner and try to run it, it throws the exception…
3
votes
3 answers

How to include all dependent Jars within a single non-executable jar?

I am stuck in a very common problem. I am plugging my jar (which has many dependencies on third party vendor) into an application server lib directory. If I just copy my jar along with its dependencies into server lib then server classpath becomes…
B Chawla
  • 574
  • 1
  • 8
  • 17
3
votes
1 answer

Akka 2.0.4 pulls in both scala 2.9.1 and 2.9.2

I'm using onejar to build an application that uses scala 2.9.2 and akka 2.0.4. When onejar does the build of my application it reports the following: [WARNING] Expected all dependencies to require Scala version: 2.9.2 [WARNING] …
user1922871
  • 103
  • 6
2
votes
2 answers

javax/inject/Inject.class in lib/javax.inject-1.jar is hidden by lib/javax.inject-2.5.0-b42.jar on onejar executable

I am attempting to create an atomic executable jar (i.e. no dependencies outside of the jar). To do this I have added a com.jolira:onejar-maven-plugin in my pom.xml. This seems to do the job, but when I execute the jar I get the warnings: …
wdtj
  • 4,554
  • 3
  • 17
  • 20
1
2 3 4 5