myeclipse8.5 packaging jars and introducing third-party jar packages

Source: Internet
Author: User

With the export tool MyEclipse, there are two ways to introduce a referenced third-party jar package:

(1) Export the jar package directly, unpack the jar package (the third party's jar package is too much, too cumbersome)

Find the Meta-inf\manifest in the created Jar file. Mf

After opening, add content as:

manifest-version:1.0
Main-class:model. Expertmain
Class-path:lib/absolutelayout.jar Lib/jxl.jar Lib/log4j.jar Lib/ojdbc14.jar

Hint: (all colons are followed by a space)

Manifest-version: For version information

Main-class: Main program entrance

Class-path:aa/bb.jar here is the introduction of the third-party package, if it is multiple packages add a space (Aa,jar Cc.jar Ee.jar)

(2) using Fatjar plug-in

Fat-jar It is an open source tool under SourceForge.net download from Http://sourceforge.net/projects/fjep

Net.sf.fjep.fatjar_0.0.31.zip

If you want to implement a referenced third-party jar that also packages the build jar, then you need to use the Fatjar plugin.

After decompression, copy the Net.sf.fjep.fat.jar under the Plugins folder to the Dropins folder under the Myeclipse8.5 or 8.x directory (for example, I use Myeclipse8.5, which is the C:\Users\ Administrator\appdata\local\genuitec\myeclipse 8.5\dropins), and then directly start MyEclipse right click on the project, you will find that the project has been integrated with the plug-in after booting right click on the project to see Build fat jar option installed successfully or, click the Preferences option in the Windows options bar to see the Fat Jar preferences option indicating that the installation was successful.

Use Fatjar to package operations as follows:

1, in your project (Packet Explorer) right-click Popup (Note: Be sure to switch to myeclipse Java perspective, can not make MapReduce perspective)

2. then Buile Fat jar appears:(note: Tick must be correct, choose One-jar have a problem)

Note here: In General, the default is to include SRC and referenced third-party jar packages (also available from Add dir to add other jar packages, which should all be referenced)

Then finish is done and available in two ways to test:

(1) under CMD, run

(2) Create a new Java project, import the generated jar package, write a main function, call the API (import successful, no red fork)

Import java.io.IOException; import Com.util.hbase.HbaseUtil; public class Testhbase {/** * @param args * @throws ioexception  */public static void Main (string[] args) throws Ioexce ption {//TODO auto-generated method Stubhbaseutil hbaseutil = new Hbaseutil (); String tableName = "Hahahh"; string[] Columns = {"Info"};hbaseutil.createtable (tableName, columns);}}

  

myeclipse8.5 packaging jars and introducing third-party jar packages

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.