i have following code of java, how to create jar file because when i create jar file its show me error please help me , jarfile name and folder same as i enter in zip please convert only zip to jar. i was convert zip to jar but my jar file does not run. thats why i am here
Zip File Link convert to jar file
If you are using netbeans IDE then right click on the project name go to properties->build->packaging.
check build jar after compiling option and ok. then click on clean and build project.
You will find your jar file in the dist folder.
EDIT: if you are using Eclipse IDE check this post. how to create jar file using eclipse
Related
I have created a JAR file, it is in "out" folder of my project, at this time the format of this file is Executable Jar File, but when I copy this file to another folder it cannot run and it says error unable to access jar file, now the format of the file is JAR file but it isn't executable jar file.
I hope to be able to keep the format of the file as executable jar file so that it can be executed on another machine at any time.
I hope someone can help me with this error and explain why it is giving me this error.
I need to add some Unicode character to JAR file, therefore I decompile the JAR file with JAVA DECOMPILER and after that I was be able to add Unicode character with Eclipse. So I need to create JAR file again after modification. I export JAR file from project and everything seems ok. But I have some problem. When I opened the original file with Java decompiler (before modification) everything is .class, after modification and export JAR with eclipse everything is .java, how can I export JAR file with eclipse as original file with .class instead .java?
before decompile and modification
after decompile and modification with eclipse
both file is jar before and after modification.
Thanks in advance
try this way
File menu --> Export --> select JAR file --> select the resources folder --> finish
for reference enter link description here
I have downloaded a zipped jar file (the jar file got zipped automaticly, there is no option not to do so).
Now I have thatLib.jar.zip
I want to 'java -jar thatLib.jar', but when i unzip the file i get a directory instead of a .jar.
I still tried to run it and got
unable to access jar file
on Windows and
Invalid or corrupt jar file
on Ubuntu.
I think the problem lies within the extraction
To be clear, i know there is a thread like this on stackoverflow and he uses eclipse while I use Intellij. Creating an executable jar in eclipse and intellij are different. So before downvote kindly consider my scenario. I created a simple java game using libgdx and want to export it in an executable jar. But before doing so, I experimented in creating a jar of the one in the tutorial video of official LIBGDX.This is the jar file Dload it here.. If you execute it opens then close again. But when i ran the project in intellij it runs without error.
This is the image i was expecting if i execute the jar file i created..
What is wrong when i tried to create a jar file?? Anyone?? Thanks
Just open your exported jar file like a zip archive and export your assets folder and libraries beside your jar file then test it again. Hope this helps.
I have a Java desktop app with gui.My app is using some xml files from the "export" folder. When I export the app into a runnable jar file, the app is not working properly, because the jar does not contain this xml files, or the path to the files is wrong.
Is there any possibility to export a Java app into an executable jar file from eclipse and to tell somehow to include an additional folder, with the same structure?
More information
My project is using some xml files, organized in the following hierarchy:
templates -> HASH CODE fgrtsgdtagsdnjf -> test -> document.xml
templates -> HASH CODE sgdtfhfnjnjcnjc -> test -> document.xml
When I export my project into an executable jar file I don't know how to specify to my app to use that files. I have FileNotFoundException.
So far, I succeed during export into an executable jar file to export that folders with XML files as well. So the files exists in the jar archive. but I do not how to indicate to use them in my project?
Since you said you get FileNotFoundException, I assume you are trying to use File, FileStream, FileReader or similar; you can't use those, you need to use class.getResourceAsStream() (search first in the the same directory as the class) or class.getClassLoader().getResourceAsStream() or getSystemResourceAsStream().
Eclipse packages the contents of the source folders (i.e. src, export and test) in the root of the JAR, so if you have "export/document.xml" you'd use 'MyClass.class.getResourceAsStream("document.xml")'. And remember to close the stream.
My app is using some xml files from the "export" folder.
If export folder has only required xml files, then just move it inside src folder. It would be automatically included once you Export as Executable Jar
Another option is to right click the folder and select Build Path, experimenting with it might help.
Is there any possibility to export a java app into an executable jar file from eclipse and to tell somehow to include an additional folder, with the same structure?
When you export as executable jar there is an option to save scenario as Ant script. Later you can modify it and Run as -> Ant