<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Bryan

      BlogJava :: 首頁 :: 聯系 :: 聚合  :: 管理
      37 Posts :: 3 Stories :: 24 Comments :: 0 Trackbacks

    Introduction

    Java developers often come to a point where they wish to deliver their application as a single Jar file. The Java Runtime Environment supports running a Jar file using the following syntax:
    java -jar jarname.jar
    
    The only requirement of the jarname.jar file is that it contains a manifest attribute with the key Main-Class a main class to run. Suppose the application entry point is the class com.mydomain.mypackage.Main. Add the following line to the META-INF/MANIFEST.MF file:
    Main-Class: com.mydomain.mypackage.Main
    
    So far so good. But, here's where the problems usually start. Any non-trivial Java application is going to rely on any number of supporting Jar files. For example, using the Apache Commons Logging capabilty to do logging an application will need to have the commons-logging.jar file on its classpath.

    Most developers reasonably assume that putting such a Jar file into their own Jar file, and adding a Class-Path attribute to the META-INF/MANIFEST will do the trick:

    jarname.jar
    | /META-INF
    | | MANIFEST.MF
    | |  Main-Class: com.mydomain.mypackage.Main
    | |  Class-Path: commons-logging.jar
    | /com/mydomain/mypackage
    | | Main.class
    | commons-logging.jar
    
    Unfortunately this is not the case. The Java classloader does not know how to load classes from a Jar inside a Jar. The entries on the Class-Path must be references to files outside the Jar file, defeating the goal of delivering an application in a single Jar file.

    Developers can write code to implement this function to load the classes from a jar inside a Jar.but we got good news that we can use the eclipse plugin FatJar in order to help us to make such a runable jar file. But Eclipse Galileo V3.5.2 has such a built in plugin to build such a jar file.It provides end users three ways and you can choose per to your request . I am pondering on this problem for two days and I hope this article which most parts come from the internet can help you.



    And you can get access to the sun website and got the following note:

    You specify classes to include in the Class-Path header field in the manifest file of an applet or application. The Class-Path header takes the following form:

    Class-Path: jar1-name jar2-name directory-name/jar3-name
    
    By using the Class-Path header in the manifest, you can avoid having to specify a long -classpath flag when invoking Java to run the your application.
    Note: The Class-Path header points to classes or JAR files on the local network, not JAR files within the JAR file or classes accessible over internet protocols. To load classes in JAR files within a JAR file into the class path, you must write custom code to load those classes. For example, if MyJar.jar contains another JAR file called MyUtils.jar, you cannot use the Class-Path header in MyJar.jar's manifest to load classes in MyUtils.jar into the class path.
    posted on 2010-06-19 15:29 Life is no respector of any genius. 閱讀(490) 評論(0)  編輯  收藏 所屬分類: Java
    主站蜘蛛池模板: 国产午夜精品免费一区二区三区| 在线观看亚洲网站| 美女视频黄a视频全免费网站色窝| 无码专区一va亚洲v专区在线| 国产精品亚洲综合天堂夜夜| 国产大片91精品免费观看男同| 亚洲成a人片在线观看天堂无码| 国内自产拍自a免费毛片| 亚洲av永久无码| 亚洲国产成人a精品不卡在线| 美女黄频a美女大全免费皮| 一级毛片直播亚洲| h视频在线观看免费| 亚洲AV无码专区电影在线观看 | 18国产精品白浆在线观看免费| 亚洲国产精品一区二区久| 最近的免费中文字幕视频| 麻豆安全免费网址入口| 亚洲综合在线另类色区奇米| 色欲A∨无码蜜臀AV免费播| 中文字幕在线观看亚洲| 成熟女人特级毛片www免费| 色一情一乱一伦一视频免费看| 国产精品V亚洲精品V日韩精品| 久久国产精品免费观看| 亚洲伊人精品综合在合线| 精品国产一区二区三区免费看| 一日本道a高清免费播放| 久久91亚洲精品中文字幕| 成年人免费网站在线观看| 理论片在线观看免费| 亚洲AV无码日韩AV无码导航 | 91精品免费不卡在线观看| 亚洲天堂2016| 中文字幕亚洲日韩无线码| 99在线观看精品免费99| 亚洲av成人中文无码专区| 亚洲不卡av不卡一区二区| 最近的免费中文字幕视频| 国内精品免费久久影院| 亚洲а∨天堂久久精品9966|