Export JAR with libraries - eclipse

I have eclipse.
I can export jar with libraries (Export->Java->Runnable JAR file->Copy required libraries into a sub-folder next to the generated JAR).
Exported libs puts into projectName_libs folder. Can I change (in eclipse) folder name for exported libs?

I'm not sure you can do it out of the box with Eclipse. However, you can manually rename the folder and then change the contents of the /META-INF/Manifest.mf file (Class-Path: entry) changing all the projectName_libs into yournewdirectory.

Related

Automaticly add 3rd pary jars to Tomcat's lib folder

I'm using Eclipse Neon 4.6 and Tomcat 8. I have my deployment assembly set with external jars via user libs and dependent projects. When I clean and build the project only the dependent project's jar files are added to Tomcat's WEB-INF/lib folder, not the 3rd party external jars even though they are specified in user libs and the lib is in the deployment descriptor. Any ideas as to why Tomcat isn't automatically coping the user lib jar files? One interesting note is that if I put the jar files in the project's WEB-INF/lib folder they are not picked up at run time either. I have also tried adding WEB-INF/lib to the deployment descriptor without any luck.
So I figured this. Turns out I correctly had libraries as dependencies in the project but did not mark them for export in Project | properties | Java build path | Order and Export. I had to check the libs for export. Now they are included in the WEB-INF/lib folder when I create the project WAR file.

Import a war in IntelliJ

I have worked on eclipse before and new to IntelliJ.
I have a war with me(its an example from apache). I want to import it to intellij. but it seems that IDEA does not support importing. I also have unpackaged version of the war file.
How can I import or do equivalent in Intellij and get all the contents?
If you mean that war also contain the source java Code, "myclass.java" here is the answer :
There isn't a direct way I know about :
first open WinRAR
drag the war file into WinRAR
extract content
copy the HTML, JSP, etc. files and css, javaScript folder to the "web folder in your project" (you should create new one before starting).
navigate to class folder deleted all .class file keep only .java files
take all folder copy to " src folder in your project "
the import thing don't forget to copy the deployment descriptor "web.xml"
finally rebuild the project

Exporting java projects in netbeans similar to eclipse

In eclipse, you can export a project as a jar file with the required libraries packaged in the same directory as the jar file in a separate folder. How exactly would I go about doing this in netbeans?
When using at. Right click on the project and select "Build" that will create a jar file in the dist directory of your project. If you have specified a main in your project that entry will be there in the manifest file, so you can easily use it a self-executing jar file.
All of the jar files that it depends on will be placed in the dist/lib directory of your project. If you are using your jar file as a self-executing jar file it is important that those files exist in a lib directory under the place where your jar file exists (i.e. their locations are recorded in the manifest file relative to the location of the jar). I know this is true when you use relative locations for your jars, but it may not be true if you've specified absolution locations.

Adding new jar in Netbeans project after building the project

I am developing a application in Netbeans7.1. I am facing one problem to add new jar file from the app after building the app.
As i know, when we build the project in Netbeans that will create a "jar" file and "lib" directory (which has all the libraries those are being used in the application) into the "dist" directory.
The problem is, I have to add new jar from my application into /lib/ directory after building the project. So that jar will be used in the application.
How should i do this?
If you have a successful build then it means the jar you wants to add is required at runtime not at compile time otherwise it wouldn't have compiled.
And if above is the case adding jar is straightforward.
Add the jar file to lib folder.
Now open you applications jar with some rar software like winrar.
Goto the META-INF folder open the MANIFEST.MF file and append the class path with lib/new_jar_file.jar.
Bingo..You are done.
Here is a screenshot of MAINIFEST.MF file and red box shows where to add the above mentioned lines.

trying to use tess4j for the first time with eclipse(any step by step for trully beginner)

I need a step to step on how to plug tess4j to Eclipse.
I found this online:
creating a lib directory and copied the tess4j.jar and its required jar in;
added the jars to build path
copied the tessdata directory and tessdll.dll file into the project root directory.
Now it just works.
I only know basic Java so I have no idea what creating a lib directory and copy directory file means at all.
Can someone help me to plug this library and make it work for eclipse because I am working in a project that needs ocr.
creating a lib directory and copied the tess4j.jar and its required jar in;
A JAR (Java ARchive) file is a collection of compiled Java classes. This is the usual way to distribute Java libraries. You should create a new folder in your project (right click your project, "New", "Folder") and copy/move the JAR you downloaded to this newly created directory. If tess4j has dependencies, i.e. needs other JARs to work, you have to put them in this directory.
added the jars to build path
You need to tell Eclipse to add the JARs to the build path, i.e. Eclipse needs to know where to get the tess4j classes from. Locate the lib folder and select all JAR files. Right click them and select "Build Path", "Add to Build Path".
copied the tessdata directory and tessdll.dll file into the project root directory.
Should be clear ;-)