executable-jar

How to create a runnable jar with maven that includes dependencies in a separate “lib” folder (not an uber jar)

不羁岁月 提交于 2019-12-03 08:41:59
I'm trying to use Maven to create an executable jar file that includes the dependencies in a separate directory. I've seen a lot of questions on SO about creating an "uberjar"--I don't want that. What I want is to have the depenedencies copied into a "lib" directory like so (and the jar MANIFEST.MF file with a ClassPath entry that points to them): /myApp myApp.SNAPSHOT-1.0.jar /lib hibernate.jar log4j.jar ... As an added bonus it would be nice if I could copy /src/main/resources/* into /myApp/conf and then zip up the entire /myApp directory into myApp.zip as well. EDIT: I use the maven

SBT project for java executable jar

无人久伴 提交于 2019-12-03 08:33:55
问题 What is the best way to set the target package for an SBT project to be an executable jar file? It would need to bundle scala-library.jar and set the manifest for main-method. 回答1: Use the assembly-sbt plugin (originally created by Coda Hale, now maintained by Eugene Yokota): https://github.com/sbt/sbt-assembly Once you add this to your project it will build a so-called "fatjar" which is executable via java -jar projectName-assembly.jar . It will autodetect your main method -- if there is

What happens when java program starts?

蹲街弑〆低调 提交于 2019-12-03 07:45:47
问题 Recently have been touched Java classloaders and suddenly recognized that do not fully understand what happens step-by-step when someone calls java -jar App.jar Well I guess a new instance of JVM is created it uses ClassLoader to load main class and other classes byte-code is started to execute from main() method But still I suppose there are many things I need to know more about it. Who and how decides which classes should be loaded at startup and which once needed? I have found two related

Include A Properties File With A Jar File

亡梦爱人 提交于 2019-12-03 07:17:20
I've written a small application. I've put the database specific information in a properties file. db.url=jdbc:mysql://localhost:3306/librarydb db.user=root db.passwd=pas$w0rd When I build the application to get the executable jar file, the properties file gets included inside. The whole purpose of putting those information in a properties file is to allow the user to change those but this is making it impossible. How can I include a properties file with the jar file not in it? Kinda like you do with AppSettings file in .NET applications. I'm very new to Java so I'd appreciate if you could

Scala SBT: standalone jar

孤者浪人 提交于 2019-12-03 07:03:12
问题 The answer: Making stand-alone jar with Simple Build Tool seems like what I need, but it did not have enough information for me, so this is a followup. (1) How do I adapt the answer to my need? I don't understand what would need to be changed. (2) What command do I run to create the standalone jar? (3) Where can I find the jar after it has been created? What I've tried: Pasting the code in the linked answer verbatim into my: project/build/dsg.scala file. The file now has a class ForkRun(info:

How do I make my java application open a console/terminal window?

↘锁芯ラ 提交于 2019-12-03 00:58:26
Is there any way I can make an executable .jar that will open up the command line when double clicked? I'm making a text-based adventure game. As of right now it is just a maze with rooms. Eventually it is going to be much bigger and more in depth but for now I just want to get the basic structure down. Anyways, to make this work I've been getting output and input from the System.out.printf command and the java.util.Scanner. It's all working beautifully so far but I've realized I'm going to run into a problem when I try to send this to other people that don't know how or just don't want to run

SBT project for java executable jar

偶尔善良 提交于 2019-12-02 23:59:53
What is the best way to set the target package for an SBT project to be an executable jar file? It would need to bundle scala-library.jar and set the manifest for main-method. Thomas Lockney Use the assembly-sbt plugin (originally created by Coda Hale, now maintained by Eugene Yokota ): https://github.com/sbt/sbt-assembly Once you add this to your project it will build a so-called "fatjar" which is executable via java -jar projectName-assembly.jar . It will autodetect your main method -- if there is more than one in your source, you can explicitly set which one to use by setting mainclass , e

What happens when java program starts?

不想你离开。 提交于 2019-12-02 21:12:55
Recently have been touched Java classloaders and suddenly recognized that do not fully understand what happens step-by-step when someone calls java -jar App.jar Well I guess a new instance of JVM is created it uses ClassLoader to load main class and other classes byte-code is started to execute from main() method But still I suppose there are many things I need to know more about it. Who and how decides which classes should be loaded at startup and which once needed? I have found two related questions but there it is not explained how to apply that to Java realities. What happens when a

spring jar bootRun causes GraphQL Schema error

痞子三分冷 提交于 2019-12-02 16:18:12
问题 When I build my Spring Boot application using gradle bootRun or build and then run the output jar, I get the following enormous list of errors out of the console log. 2018-03-18 00:49:38.754 ERROR 228 --- [ main] o.s.boot.SpringApplication : Application startup failed org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embedded Tomcat at org

How to run jar file using docker file in docker container

我怕爱的太早我们不能终老 提交于 2019-12-02 14:44:25
问题 I write the docker file for run the jar file and it does not create the log file for see the console below is my docker file From ubuntu RUN apt-get update && \ apt-get upgrade -y && \ apt-get install -y software-properties-common && \ add-apt-repository ppa:webupd8team/java -y && \ apt-get update && \ echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections && \ apt-get install -y oracle-java8-installer && \ apt-get clean VOLUME /temp RUN