add jar files to classpath to eclipse - eclipse

in this link http://mina.apache.org/mina-project/userguide/ch1-getting-started/first-steps.html says "Put the following jars in the classpath"
what does that mean? how can I do that in eclipse? without eclipse?

Here's how you could do it in eclipse:
Right click on your project
Select Build path -> Configure Build Path
Select libraries tab
Click on add external jar and select the jar file by browsing your file system and click on open.
click on ok on your configure build path screen.
Without eclipse, when you are about to compile, you will need to use:
javac -classpath <all jar files class path seperated by ; in windows or : on linux> java source file
And similar option while running the class via java command.

Related

How can I connect TestNG javadocs to Eclipse?

Although we can find TestNG javadocs, is there a way to download a srcs.jar and connect to Eclipse?
Steps:
Download the jar file based on your version of testng, here. The jar file name should be like testng-version-sources.jar
Extract to one of the locations.
Then go to the eclipse project that you want to add source jar.
Short cut: Double click on any of the testng class/annotation in your source code, like double click on #Test annotation.
Eclipse tries to open Test.class source code. As src jar is not yet present, gives option Attach Source. click on the button.
select External location radio button.
select the jar file, which is downloaded.
Click on Ok. you will get the source code for Test.class (of course, for all other testng classes as well)

Running an eclipse created jar file

I have created a jar file in eclipse and now I want to execute the jar file in command prompt.
How can I do that?
When your creating jar file using eclipse
While reaching JAR manifest specification
enter main class
Run this command from command prompt:
java -jar <JarName>.jar
Note: you will need to jar a file called META-INF/MANIFEST.MF in order to run the jar after compilation.
If you are creating the jar using Eclipse do this:
Go to file > Export > Java > Jar file (hit next)
Select your project and all the files you would like to jar
Type below the destination of the jar (e.g. c:\MyJar.jar) (hit next x2)
On the bottom Main class either hit browse and choose the class which contains main or type: package_name.class_name (wihch contains the main entry point)
Hit Finish
Go to the jar location in command prompt and run as i mentioned above

Creating jar executable w/ external jar (JXL) in ECLIPSE java

I can't find a working solution for my jar executable. The program runs perfect in my Eclipse IDE, but when I attempt to follow Eclipse instructions, the executable does not work with external JAR.
The JXL jar is in my build path. Anyone know how to get this working through Eclipse? I do not have access to command line.
1.) Right-click on project, select pop-up menu entry "Export...".
2.) Select "Java -> Runnable JAR file".
3.) Choose a working launch configuration for running your program via java -jar MyExecutable.jar from the command line later. Select an output folder and file name. Select "Package required libraries into generated JAR".

Properly adding a Facebook jar in Eclipse for Blackberry

How to add Facebook .jar file properly in eclipse for blackberry
"ERRO :Module 'FacebookBlackBerrySDK-v0.8.25' not found."
Below is the step to add the jar properly to your eclipse project. Its seems that you are not adding the jar properly in your eclipse environment. So check the step please.
Create a folder called “lib” (or whatever you want to call it) under your project, and copy the downloaded JAR files into that folder.
Right-click your project > Properties
Java Build Path > Libraries > Add JARs… > Choose the JAR files in the “lib” folder
Java Build Path > Order and Export > Check the JAR files

How to create a Jar file in Netbeans

Well I have my source code that i have done using the IDE netbeans. Now I wanted to move this java application to a web application. For that I need to create a jar file from my source code, so that I could invoke it in ma jsp file.
I have not been able to find any option in netbeans or any other way to create a .jar file of this source code.
Could someone tell me how to do that.
Thanks
Create a Java archive (.jar) file using NetBeans as follows:
Right-click on the Project name
Select Properties
Click Packaging
Check Build JAR after Compiling
Check Compress JAR File
Click OK to accept changes
Right-click on a Project name
Select Build or Clean and Build
Clean and Build will first delete build artifacts (such as .class files), whereas Build will retain any existing .class files, creating new versions necessary. To elucidate, imagine a project with two classes, A and B.
When built the first time, the IDE creates A.class and B.class. Now you delete B.java but don't clear out B.class. Executing Build should leave B.class in the build directory, and bundle it into the JAR. Selecting Clean and Build will delete B.class. Since B.java was deleted, no longer will B.class be bundled.
The JAR file is built. To view it inside NetBeans:
Click the Files tab
Expand Project name >> dist
Ensure files aren't being excluded when building the JAR file.
Please do right click on the project and go to properties.
Then go to Build and Packaging.
You can see the JAR file location that is produced by defualt setting of netbean in the dist directory.
I also tried to make an executable jar file that I could run with the following command:
java -jar <jarfile>
After some searching I found the following link:
Packaging and Deploying Desktop Java Applications
I set the project's main class:
Right-click the project's node and choose Properties
Select the Run panel and enter the main class in the Main Class field
Click OK to close the Project Properties dialog box
Clean and build project
Then in the fodler dist the newly created jar should be executable with the command I mentioned above.
Now (2020) NetBeans 11 does it automatically with the "Build" command (right click on the project's name and choose "Build")