executable-jar

how to create a runnable jar file from command line similar to eclipse

假装没事ソ 提交于 2019-12-04 10:27:52
I understood that eclipse generates a runnable jar file with all library .jar files extracted and included in the jar file. How do I do the similar this while creating a jar file manually from command prompt. Do I need to extract all the lib jars into classes folder? Currently I am using - jar cvfm example.jar manifest.txt -C Classes/ . Which creates a jar file with all the class files and I need to have all the library jars in the same folder as this example.jar exists. there's no way do this kind of thing from the jar command line utility. there are 3 main solutions to the dependencies

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

青春壹個敷衍的年華 提交于 2019-12-04 08:31:55
问题 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

Exported runnable JAR file from Eclipse doesn't seem to execute

老子叫甜甜 提交于 2019-12-04 08:17:55
(Disclaimer: I am not a Java programmer, and really have very little idea what I'm doing in Eclipse) I hacked out an application in Eclipse a while back which I finished off and exported as a JAR which runs nicely. I didn't take any notes or make any comments. The time comes to make some changes to the project but I have to reload it all again because my PC has since been wiped so some settings etc have probably changed. Anyway it all works and runs nicely from Eclipse. But when I export as a runnable JAR, and double click to run the application, it doesn't seem to execute. I can see that

Exporting runnable JAR file does not support UTF-8 encoding - Java Eclipse

a 夏天 提交于 2019-12-04 05:32:47
问题 I made this small Java program using eclipse IDE. I have set the workspace to support UTF-8 and the program runs happily when executed from eclipse. Part of the program is that it writes some data to a file (needs UTF-8, since its in Arabic). I need to export a runnable JAR file to give my client this program... My Problem: When I export the program using "Export to Runnable JAR file", it runs perectly, BUT the data, written in Arabic, to the file ends up being question marks >.< .. This

How to make ImageIO read from InputStream :Java

强颜欢笑 提交于 2019-12-04 05:24:24
I have created executable jar file(using Eclipse) , there are a set of image (.png) files that is to be inculded in the jar. So I have added a source folder with all the images inside /images folder in the project . Code has to access these file to create BufferedImage using ImageIO.read(new File(path); Earlier, To get the path I used ClassName.class.getResource(/image/test.png).toURI(); On executing jar , it throw error URI is not hierarchical So now I am using ClassName.class.getResourceAsStream(/image/test.png); But how to make ImageIO read from Inputstream ? I tried cast as follows

Jar File - Prevent Access to Source Code

依然范特西╮ 提交于 2019-12-04 03:37:45
问题 I want to hand over a small Java app as a runnable jar but I do not want anybody to have access to my source code. Am I right in presuming that there is no source code (.java files) included with a jar file? User269799 回答1: You are right, there is no source code in the jar (unless you configure your build system to specifically put it in there). But you are always at the risk you code gets decompiled from the bytecode. An obfuscater might help here. 回答2: Assuming you don't put the java files

Exporting A Libgdx Game as Executable Jar from Android Studio

只愿长相守 提交于 2019-12-04 02:58:58
Okay so I made a game using Libgdx and I intended it to be a android app(which is why i use android studio) but I want to let my friend without android phones try it out. The project is already setup for both desktop and android so is there any way to export this as a executable jar file? TomGrill Games Type the command below in the terminal. Remember that you have to be in your LibGDX root directory, before issuing this command. gradlew desktop:dist More at: https://github.com/libgdx/libgdx/wiki/Gradle-on-the-Commandline#packaging-for-the-desktop You have to type gradlew desktop:dist command

How do I include external JARs in my own Project JAR

有些话、适合烂在心里 提交于 2019-12-04 01:13:29
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 having to copy the Log4J JAR into the same directory as my own JAR which kinda defeats the purpose of the jar. Wouldn't it be more elegant to have 1 single JAR file to deploy? coder623 If you use Eclipse, You can extract all included files into one runnable jar like this: Right click on your project name from Package Explorer and select Export. In Export

The simplest way to create jar file?

大憨熊 提交于 2019-12-03 20:40:22
I have a java project and i need to create jar file from my project . any body can tell me what is the simplest way to make this? From scratch.. with CMD The command line is what almost every other application will use to build your JAR file. They just wrap it up a little nicer for you. In truth, it's very simple to do yourself. Obviously Java have explained this way in detail so there is no sense in me repeating it. Note : You need to have your JDK/bin directoy appended onto your %PATH% system variable to be able to use this method. Double Note : As pointed out in the comments, I'd suggest

URL.setURLStreamHandlerFactory

萝らか妹 提交于 2019-12-03 13:45:12
I am developing a web application using an executable jar with embedded Jetty. My jar contains a dependent jar.(jar in jar) I referenced to the JarRsrcLoader and RsrcURLStreamHandlerFactory that developed by Eclipse. JarRsrcLoader is using URL#setURLStreamHandlerFactory(RsrcURLStreamHandlerFactory) to resolve rsrc protocol. Thereby it can resolve class path for jar. But it becomes impossible to solve the usual protocol as side effects. for example file:xxxx or jar:xxxx . RsrcURLStreamHandlerFactory has setURLStreamHandlerFactory method. Maybe I think I should set the default implement to this