executable-jar

Runnable jar file generated by Eclipse wont execute?

天大地大妈咪最大 提交于 2019-11-29 07:42:25
I generated a very simple runnable jar file using Eclipse's "Export-->Java-->Runnable Jar File" function. My HelloWorld class looks like this: import javax.swing.JFrame; public class HWorld extends JFrame { public static void main(String[] args) { new HWorld(); } public HWorld() { this.setSize(200, 100); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setTitle("Hello World!"); this.setVisible(true); } } Now, after generating the .jar file , it runs fine from the command line using the command "java -jar HWorld.jar" But, when I try to execute the jar on its own (which supposedly

JAR hidden inside EXE?

邮差的信 提交于 2019-11-29 06:15:45
Minecraft , a Java game, is free this weekend. The Windows version downloads as an exe file. I was curious what the EXE file is doing and where it's unpacking and running the actual game JAR from. So using a command, I found the command-line arguments to the running javaw.exe process; and oddly enough, it was launched with a classpath pointing to the executable! (meaning, the .exe file was acting as a jar). Indeed, after renaming Minecraft.exe to Minecraft.jar, I was able to open it and see the loader class files and such, as if it were a normal JAR file and not an EXE at all. How is this

including an exe file to jar

半城伤御伤魂 提交于 2019-11-29 05:11:01
I have written a java program that is actually works as a gui to an existing command line program. so in basic all my program does is Runtime.getRuntime().exec("myprogram parameter"); . So I have exported my java source as a executable-jar file by using Eclipse IDE and it is working nice, however I indeed need to include this myprogram.exe to the directory of the generated jar file inorder to work. Now I am looking for a way to include myprogram.exe inside the jar file so I can keep it bundled as a single file, a method using using Eclipse would be preferred. You can simply jar it up as an

“scala.runtime in compiler mirror not found” but working when started with -Xbootclasspath/p:scala-library.jar

江枫思渺然 提交于 2019-11-29 03:45:26
I'm trying to run a Scala application packed as JAR (including dependencies) but this fails until the Scala library is added by using the -Xbootclasspath/p option. Failing invocation: java -jar /path/to/target/scala-2.10/application-assembly-1.0.jar After the application did some of its intended output, the console shows: Exception in thread "main" scala.reflect.internal.MissingRequirementError: object scala.runtime in compiler mirror not found. at scala.reflect.internal.MissingRequirementError$.signal(MissingRequirementError.scala:16) at scala.reflect.internal.MissingRequirementError$

apache spark: akka version error by build jar with all dependencies

烂漫一生 提交于 2019-11-29 02:21:28
i have build a jar file from my spark app with maven (mvn clean compile assembly:single) and the following pom file: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>mgm.tp.bigdata</groupId> <artifactId>ma-spark</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <name>ma-spark</name> <url>http://maven.apache.org</url> <properties> <project.build.sourceEncoding>UTF-8</project

Minimize an Uber Jar correctly, Using Shade-Plugin

十年热恋 提交于 2019-11-29 01:07:27
I am using the Maven-Shade-Plugin to create a runnable Uber-jar. According to the last frame on this page , the size of the jar can be minimized by using: <configuration> <minimizeJar>true</minimizeJar> </configuration> But this feature does not take into consideration the classes that are declared in the log4j.properties file. Hence, e.g. org.apache.log4j.appender.TimeAndSizeRollingAppender is not included in the Uber-jar, even though it’s declared in the log4j.properties file. I believe I will face the same problem with Spring. If my code only refers to interface A and my Spring file

How do I create an executable fat jar with Gradle with implementation dependencies

送分小仙女□ 提交于 2019-11-29 01:05:58
I've got a simple project in Gradle 4.6 and would like to make an executable jar of it. I've tried shadow , gradle-fatjar-plugin , gradle-one-jar , spring-boot-gradle-plugin plugins but neither of them adds my dependencies declared as implementation (I don't have any compile ones). It works with compile e.g. for gradle-one-jar plugin but I would like to have implementation dependencies. Thank you very much! miskender You can use the following code. jar { manifest { attributes( 'Main-Class': 'com.package.YourClass' ) } from { configurations.runtimeClasspath.collect { it.isDirectory() ? it :

how to check the version of jar file?

做~自己de王妃 提交于 2019-11-28 22:12:22
I am currently working on a J2ME polish application, just enhancing it. I am finding difficulties to get the exact version of the jar file. Is there any way to find the version of the jar file for the imports done in the class? I mean if you have some thing, import x.y.z; can we know the version of the jar x.y package belongs to? Vivek Decompress the JAR file and look for the manifest file ( META-INF\MANIFEST.MF ). The manifest file of JAR file might contain a version number (but not always a version is specified). You need to unzip it and check its META-INF/MANIFEST.MF file, e.g. unzip -p

Selecting main class in a runnable jar at runtime

孤者浪人 提交于 2019-11-28 21:09:05
I have two main classes in the app. When I package it to a runnable jar (using Eclipse export function) I have to select a default main class. Is there a way to access the non-default main class from the jar at runtime? You can access both via java -cp myapp.jar com.example.Main1 and java -cp myapp.jar com.example.Main2 . The default main class in the jar is for when you invoke your app via java -jar myapp.jar . See JAR_(file_format) for more details. When you select the main class in Eclipse this is what gets set in: Main-Class: myPrograms.MyClass inside of the jar manifest META-INF/MANIFEST

How can you package an executable jar with a portable JRE?

会有一股神秘感。 提交于 2019-11-28 20:49:43
I want to be able to distribute by executable JAR without having to make the user upgrade to the latest version of the JRE. How can I package a JRE into the JAR so that they can run the jar with no JRE installed on their system? Put Java Portable in a sub-directory and launch your jar using a batch/bash script or Launch4j . As you need a jre to execute a jar, I'm afraid this is not possible. I have once used izpack together with launch4j to make a Windows EXE that would install a jre with my application. 来源: https://stackoverflow.com/questions/664858/how-can-you-package-an-executable-jar-with