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.
Related
I am working on a project,
where I have Project A and in that project A have lots of jar file and that all jar file depends another project B.
How to add project A jar file into Project B.
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.
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.
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 ;-)
I have the log4j.properties and another .properties file under src and it works deployed in gwt dev mode. To build the war to launch to tomcat I use an ant script that compiles the .java classes and puts them in a JAR file. The JAR file gets copied into the WEB-INF folder in the war file.
The app runs fine when I don't use log4j but it can't find the properties file when I attempt to use log4j. All of the answers I see say WEB-INF/classes, but my project doesn't have a WEB-INF/classes directory, instead the JAR file that was copied to WEB-INF contains my projects classes.
You have to put log4j.properties (or log4j.xml) file into directory or JAR that is considered by your servlet-container as resource in Classpath.
So, simply create WEB-INF/classes directory and put it there, or pack it into your JAR.
See also Where should I put the log4j.properties file? - it could be useful.