Deploy Eclipse 4.1 Project - java

I have create a simple program using Eclipse 4.1.. I wanted to build or deploy my project into a .jar. I also added external libraries in my project. I wanted the output same as in Netbeans with the .jar file and lib folder in the dist folder, but there should be also a folder named help and lang.. How can I do this with eclipse?!

Follow the steps provided here.
Or if you don't want to complex things up, select Runnable JAR file instead of JAR file set the directory where the .jar is to be written then click Finish.
Eclipse will create the [Project Name]_lib directory for the external libraries included in the project.

Related

Is there any tools help to reverse jar to java eclispe project

All, I have a jar file. and I know it is built from a swing project. Becuase I already view some source code of class files of the jar. I want to know if there exists any tools help to convert the jar back to the source project in the eclipse? Thanks.
http://jd.benow.ca
Drag and drop jar file into JD GUI decompiler
select File-> Save all sources
7zip will allow you to view the contents of the jar, including source files if they are there. Lots of decompilers exist to decompile the class files. My favorite is jd-gui (http://jd.benow.ca/).
You can also add a jar in Eclipse by right-clicking on the Project → Build Path → Configure Build Path. Uthen under tje Libraries tab, click Add Jars or Add External JARs and select the jar file. Alternatively you can add a lib directory to your project and put a copy of the jar there.
But as far as converting a jar file into an eclipse project, you could extract the files with 7zip or other tool, then import them into a new eclipse project.

binding class files in the jar file not generated by netbeans

When i clean and build my project using netbeans , though it makes the jar file of the project but it doesn't keep those files that i myself kept in the project folder. That includes some class files,a music file. What is the reason for this ? How do i do this ? I want to keep some class files not generated by the netbeans and also the music file.
What is the reason for this ? default Netbeans build.xml don't include other lib files.
If you look the dist folder you can see a lib folder too. This is your lib folder. If your lib files is in the classpath you jar run on every where if not your file look ./lib/*.jar
You can change your project to ant project or maven project and change your manifest and other files.

creating a jar for a project in Eclipse

I am using Eclipse and I have just started working on a project that needs another project (say pjkt) to function. The pjkt project files are stored in a specific folder. I would like to create a jar from pjkt and then add this jar to my project buildpath. How do I do this? Do I need create first in Eclipse a new project from the pjkt code, build it and then select the export command?
Yes create a new project and export as .jar.
To answer the question about the build path:
Create a project directory (in the using project) for library files - it's common to create it in parallel to /src and /bin and call it /lib;
Once you've created (by exporting) your jar from the used project, copy it into the /lib directory;
If you did any of this creating and copying outside of eclipse, refresh your project so everything will show up in the Project Explorer;
In the Project Explorer, right-click on the .jar in the /lib folder and do "Build Path | Add to Build Path".
Done!
If you need to work on both projects, and have them open in Eclipse at the same time, another approach is to open Properties -> Build Path for the new project, and add pjkt on the Project Dependencies tab. This will provide all the exported resources from pjkt to the master project.

creating jar file for java application

i have created a java application which uses data from its config folder and , it also uses third party jar files those are located in lib folder, could anyone tell me how to create jar file for this project with the content stored in config file and lib folder.
i tried creating jar using eclipse export functionality. when i run this jar file, it says it can not find the third party libraries that i have used for this project and configuration file.
thanks in advance for any help
You can create a Runnable JAR in Eclipse 3.4+ in the Export wizard selection dialog (right click on a project and go to Export...) using an existing launch configuration which will incorporate the libraries or repack them. Config files should be readable from the same directory as the runnable jar is located. If you need any help with loading these in, just ask :)
(source: eclipse.org)
You have two options
include the stuff in the third-party jars in your jar
provide access to the jars on the classpath when you run your jar.
Both have their benefits and their drawbacks.
Java does not support putting JAR files inside executable JAR files, so you can't just put your third-party library JAR files inside your own JAR - Java won't be able to find them.
If you don't want to distribute your application as a whole bunch of JAR files, you can use a look such as One-JAR which will build a JAR file for you that contains your own classes plus the classes of the third-party libraries that you're using.
To learn more about how to package a program in an executable JAR file, see Packaging Programs in JAR Files in Sun's Java Tutorials.
If you use netbeans just by click on "build" a jar file will show up in the "dist" file in your project directory

how can we create a jar file for our program?

I work with netbeans,how can I create a jar file for my program?
please help me thanks.
Netbeans: Packaging and Deploying Desktop Java Applications (Main Exercise: Creating and Distributing Executable JAR Files)
If you use the built in project templates NetBeans builds jar files automatically. Just select "Build" from the context menu (right-click your project node) and the jar file will be created inside a "dist" directory in project folder.

Categories

Resources