executable-jar

Create multiple runnable Jars (with dependencies included) from a single Maven project [duplicate]

北城余情 提交于 2019-11-27 12:22:49
This question already has an answer here: Creating Two Executable Jars Using maven-assembly-plugin 1 answer I have a single maven project that has multiple main classes. I want to generate runnable Jars (that include all dependencies) out of these project. I currently have the following build configuration (using maven.assembly): <build> <plugins> <plugin> <artifactId>maven-assembly-plugin</artifactId> <configuration> <archive> <manifest> <mainClass>classpath.to.my.mainClass</mainClass> </manifest> </archive> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef> <

Start a jar file like service in linux [closed]

心不动则不痛 提交于 2019-11-27 11:03:52
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . I want to start and stop my jar file as follows service myService start service myService stop my current jar file running as follows cd /home/alex/IdeaProjects/myService java -jar target/myService-SNAPSHOT-1.jar server config.yml What should I do? 回答1: You need a Service Wrapper to run the Jar file. There are

Java - Writing to txt in a JAR file [duplicate]

こ雲淡風輕ζ 提交于 2019-11-27 07:50:32
问题 This question already has answers here : Closed 6 years ago . Possible Duplicate: How can a Java program use files inside the .jar for read and write? How do I write to a .txt file from a JAR java compiled project? When I run my projects, it doesn't give errors, but it just doesn't write to the .txt inside JAR file. I make the JAR file using: netbeans clean /build tool Code: public class FileIO { private File file; private Scanner filescScanner, lineScanner; private PrintWriter fileWriter;

What happens to “System.out.println()” in executable jar?

若如初见. 提交于 2019-11-27 07:39:24
问题 Suppose I've created an executable jar from a code where I have used System.out.println() When we run the executable jar, there is no console. So, what happens to this line? How does java handle this situation? EDIT 01 : NOTE : The situation is when I don't use a console to run the jar nor associate any console with it anyhow. EDIT 02 : Making things clearer: I know that nothing will be printed anywhere as there is no console..! I want to know how java handle this line in this case? Is this

How to call an executable jar from php with an argument passed to main method

半世苍凉 提交于 2019-11-27 07:08:46
问题 I have created an executable jar and it works fine. For the testing purpose, I have used a dummy variable in the main method. Instead, I need to pass a string variable, while calling this executable jar from php. In short, I need to: Call the executable jar from PHP While calling the jar, I need to pass a string variable from PHP to the main method of the class inside executable jar. How can I accomplish the aforesaid? 回答1: shell_exec("java -jar your_JAR.jar arg1 arg2"); you can also execute

Could not find or load main Class on JAR executing

╄→гoц情女王★ 提交于 2019-11-27 06:21:59
问题 I finished my project (in NetBeans ) and i export Jar file (i set my main class in project properties correctly before exporting Jar ): Now, This is my JAR : This Error shown when i run the Jar (in command line page): Could not find or load main Class on JAR executing This is my MANIFEST.MF information: Manifest-Version: 1.0 Ant-Version: Apache Ant 1.9.1 Created-By: 1.7.0_11-b21 (Oracle Corporation) Class-Path: lib/mysql-connector-java-5.1.18-bin.jar X-COMMENT: Main-Class will be added

Eclipse: export to .jar AND include resource files (ANT)

依然范特西╮ 提交于 2019-11-27 06:14:07
问题 Our project in eclipse approximately shows the following folders: application - src - JRE System Library [1.6] - Referenced Libraries - lib - rsc In our project, we would like to use File > Export... > Executable JAR Well that works fine, with some exception: If we want to run our application.jar, we still need to copy the folder rsc/ in the same location as application.jar. In rsc/, we have other folders for separation of the different parts. Basically, we load the pieces using the code

Double Clicking JAR file does not open Command Prompt

ε祈祈猫儿з 提交于 2019-11-27 05:20:51
I want to run a Jar file by double clicking it. Following is the only Java class file present in it. import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; public class Sysout{ public static void main(String[] args) throws IOException{ System.out.println("Hello World!"); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String msg = br.readLine(); System.out.println(msg); br.read(); } } And Manifest file has Main-Class defined. Using this link, I successfully ran the Jar file by double-clicking the batch file. This opens the command

Create an excutable jar in IntelliJ IDEA

淺唱寂寞╮ 提交于 2019-11-27 04:19:33
问题 I am using IntelliJ IDEA 12.1.3. I have one module and I am trying to convert it into a jar as per the steps given here. I built the jar file and I moved the jar file to D:/. If I try to run this jar I get the following message: Failed to load Main-Class manifest attribute from jar If I run it using java -classpath jar com.code.TestCase it works perfectly. Why does this happen? I created the jar using IntelliJ IDEA. In that jar it has all the code for all external libraries which I added. In

Set Icon for executable Jar file [duplicate]

女生的网名这么多〃 提交于 2019-11-27 02:13:19
问题 This question already has an answer here: How to change executable jar file icon? 5 answers I have a simple executable Jar file. How I can set icon for this file? In my case I use the standard Jar icon which I would like to change. 回答1: you can use setIconImage : frame.setIconImage( new ImageIcon(getClass().getClassLoader().getResource("PATH/TO/YourImage.png")) ); Update If you want to change the coffee-cup then you may use tools like JSmooth to create executable java file and also change the