This question already has an answer here:
How to export an Eclipse Project with External Jar dependencies?
(1 answer)
Closed 8 years ago.
I have developed a program that includes external jars also. Now I need to convert this program to a runnable jar (It has main method) and place it another location.
But how to include the external dependencies along with this conversion . I dont want other to download the external jars again and again.
Regards,
Siva
Right click on your project then go to Export -> Java -> Runnable JAR File and there select Package Required libraries into generated JAR radio box
Related
This question already has answers here:
Get source JARs from Maven repository
(20 answers)
Closed 6 years ago.
Is there any way to view the source code of existing jars like those in Maven dependencies in Eclipse.
How is it possible to browse on the libs and view the source codes?
You can use Java decompiler plugin (Jad). It will decompile class file and you can see source code. This plugin can be easily integrated with eclipse
You can use below link to configure Jad in eclipse
http://www.mkyong.com/java/java-decompiler-plugin-for-eclipse/
This question already has answers here:
How can I convert my Java program to an .exe file?
(16 answers)
Closed 7 years ago.
I am new for java. As a first step, I made a simple calculator in NetBeans.
I wanted to make it an executable software and to run it just by double clicking it as on visual basic.
Please tell me if you know a method to do that.
I don't know your IDE but you need to export an as executable jar file. Then you can run that.
In Eclipse:
File > Export > Runnable Jar File > Choose your path > Click export
Right click on the project -> Clean and build
You can find the runnable jar in your project folder > dist (newly created folder)
This question already has answers here:
Whats best way to package a Java Application with lots of dependencies?
(7 answers)
Executable Jar with depedencies
(5 answers)
Closed 7 years ago.
I made my first application with Java in Eclipse now I need to repackage or create an executable file file from that project. I used a lot of external jar libraries that I would like to export whit the project. Any solution is welcome.
I suggest to use apache maven to make a fat jar in conjunction with the launch4j maven plugin to make an self-contained exe (i.e. a wrapper for the jar).
you can make a executable jar file of that project. And then make a .bat file. From that .bat file you can invoke that executable jar.
Eclipse will pack you yourprojectname.jar file, which is executable file. So, in order to run it you may just run in command line (a.k.a cmd) java -jar path/to/your/project.jar. And of course it is more easier to run it with script. There are .bat files which are something like .bash scripts in linux/unix
Right click on your Eclipse project in ProjectExplorer
Export...
Java\Runnable jar file
On dialog Runnable JAR file export
4.1. Choose the main() method you need to start from the popup "Launch configuration"
4.2. Specify the output jar like: d:\dest.jar
4.3. "Finish'
This question already has answers here:
How to create a Jar file in Netbeans
(4 answers)
Closed 9 years ago.
I created a java project using netbeansIDE. Now I want to convert it into an .exe file, but I need to convert the java project into a .jar file first, since java project can't be compiled into a .exe file directly it can be only be converted to exe from jar file. So how shall I convert java project into a .jar file. Please answer in detail since I am a beginer in java programing.
Thank You.
If you are using Netbeans IDE then you can easily build a jar file of your project.
Just go to Run in the Menu above and select clean and build.
Now goto to you project folder, find Dist folder inside it and there you have your .jar file.
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How to determine which classes are used by a Java program?
I have a Java project on Eclipse that contains a lot of Java classes. I want to export one of them to a .jar file but I ran into some problems.
I already read through some existing threads, but I didn't get the right answer for my requirement, because:
If I choose "Export to JAR file" I get the right class exported, but the .jar file does not contain the required dependencies to run the jar file.
If I choose "Export to runnable JAR file" the resulting jar file contains all dependencies but also puts in all the other classes from the whole project (also those that I don't need).
How can I export the single Java class to a .jar file that includes also required libraries for running the jar file? The resulting jar file has to be as small as possible.
Thanks a lot.
You could create a new project with only the class that you need in it and export that project as a runnable jar.
There might be a workaround, depending on the use-case you need this for. Generally, a full dependency analysis will not be possible since your code might load classes at runtime etc.
If you need the .jars to be as small as possible (e.g. if you want to be able to "klickstart" parts of the application and not waste storage redundantly) you might use
Export... -> Runnable JAR File -> Copy required libraries into a sub-folder...
ant then keep only one copy of the external libraries for all jars.
Please provide more info on what your use-case is, so that we can post more specific answers :)
Try this, this is the way to create a jar or runnable jar in eclipse
File -> Export-> Java ->Runnbale JAR file
Launch configuration : your Class containing the public static void main(String[] args)
Export destination : Target place
Library Handling:
Package required libraries into generated JAR
FINISH