Questions tagged [executable-jar]

A special type of jar file which contains all non-standard libraries and definitions necessary to run an application on a JVM.

An executable java program which can be started manually by typing java -jar foo.jar. Some operating systems (including Windows, Solaris and some Linux distributions) provide means to run the jar just as any other executable on that system.

Executable JAR files are distinguished by a 'extra field' on the first file with a hexadecimal field code of 0xCAFE. They must also specify a main class in the manifest (Main-Class: fooPackage.BarClass) which will be used to start the application.

2420 questions
11
votes
6 answers

How do I include external JARs in my own Project JAR

I have a Java application and created a JAR file and deployed it. The App uses external JARs such as the Log4J JAR. When creating my JAR file, how do I include all external dependent JARs into my archive? In order to get my App working, I'm…
Wilko
  • 289
  • 1
  • 4
  • 14
11
votes
1 answer

How to make an executable jar file using IntelliJ from a Selenium/TestNG java file?

I've been Googling for days trying to figure out how to do this, if anybody has done this before I would greatly appreciate the help. I have an automation test project I've created in IntelliJ that automates a user interacting with a Web…
urbanaut
  • 741
  • 2
  • 11
  • 26
11
votes
1 answer

Maven and Netbeans: how do I build project and get executable jar?

I've just started standard Maven -> Java Application in Netbeans 7.4. It created "App" class (which has main method) by default. I also went to project's Properties->Run and set that class as a Main Class. I then built the project. In the project's…
user1666562
11
votes
5 answers

How to specify JVM argument for Maven built executable JAR

When using Maven to build an executable JAR, how do I specify the JVM arguments that are used when the JAR is executed? I can specify the main class using . I suspect there's a similar attribute for JVM arguments. Specially I need to…
Steve Kuo
  • 61,876
  • 75
  • 195
  • 257
11
votes
2 answers

cannot set classpath with maven-assembly-plugin

I am creating console application. I want to have configuration files outside the jar file in conf folder and want to register this folder as a classpath for my application. I run mvn assembly:single command , get a jar file, BUT when I try to run…
D.R.
  • 437
  • 2
  • 8
  • 20
11
votes
6 answers

Cannot open Selenium Jar file from CMD. Path or ClassPath issue?

I'm trying to launch: java -jar selenium-server-standalone-2.14.0.jar -role hub from my Command Prompt but output was as below: C:\Program Files (x86)>java -jar selenium-server-standalone-2.14.0.jar -role hub Unable to access jarfile…
lbrown
  • 615
  • 3
  • 10
  • 19
11
votes
6 answers

Why is my .jar file running slower than the program in eclipse?

I have a java program that reads a lot of input data from a database, manipulates it, then writes data back out to another database (using ODBC drivers, excel and access databases, on a new windows 7 machine). The program takes about 17 minutes to…
scaevity
  • 3,991
  • 13
  • 39
  • 54
10
votes
1 answer

Running JAR file on Windows 10

I have made a Jar file, but I cant make it to run by double clicking. It works fine using java -jar name.jar or by making a batch file. I have already reinstalled jdk1.8.0_102, set the JAVA_HOME variable and javaw.exe in the jre folder is already…
Asnira
  • 313
  • 1
  • 4
  • 9
10
votes
1 answer

How do I package up an applet with multiple .jar libraries?

I'm creating a Java applet from a large scale pre-existing project (Vizster). I am using NetBeans 6.7.1 with JDK 1.5 on Mac OS X. I am attempting to run the applet from it's single output .jar file, but when I do this, it says "applet loaded" at…
mag725
  • 695
  • 2
  • 9
  • 22
10
votes
2 answers

Executing a JAR file straight from a Maven repository

Suppose that we have a Java application, rather than a library, which is available through Maven central. For example, one such project is jol, which has its corresponding CLI interface in Maven central. As far as I can tell, the main difference…
thkala
  • 84,049
  • 23
  • 157
  • 201
10
votes
3 answers

How to run standalone TestNG project from jar/bat/

I have a TestNG project. Don't have any main class, currently it is running like "Run As TestNG". I want to export it as runnable jar or jar so that any one can just hit a command from command line and test cases start running. Could any one help me…
itin
  • 430
  • 3
  • 9
  • 20
10
votes
4 answers

What happens when java program starts?

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…
Nikolay Kuznetsov
  • 9,467
  • 12
  • 55
  • 101
10
votes
9 answers

"Could not find main method from given launch configuration" when using Java+Scala+Slick2D

I've got a project in which I'm using Java+Scala+Slick2D. The project itself runs well when launched from within eclipse. But when I try to make a jar file, it just refuses to work. Here's the error I keep getting when trying to export it as a…
Plasty Grove
  • 2,807
  • 5
  • 31
  • 42
10
votes
3 answers

Eclipse : manually select main class for executable jar file

I have java project, and many class that have main method (just for testing purpose). When I create executable jar file by Eclipse, Eclipse will automatically selects which file is main class. (and often wrong). There is another way is change main…
hqt
  • 29,632
  • 51
  • 171
  • 250
9
votes
5 answers

Executable JAR on Ubuntu (NetBeans)

I'm writing a simple Swing application in NetBeans and doing so on an Ubuntu machine for the first time. As many of you know, NetBeans automatically creates executable JARs for projects that are "set as main". On Windows, you can double-click an…
Sarah
  • 93
  • 1
  • 1
  • 3