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

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

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

    Bryan

      BlogJava :: 首頁(yè) :: 聯(lián)系 :: 聚合  :: 管理
      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. 閱讀(500) 評(píng)論(0)  編輯  收藏 所屬分類: Java
    主站蜘蛛池模板: 一区二区三区亚洲| 亚洲情侣偷拍精品| 91久久精品国产免费直播| 亚洲男人的天堂在线va拉文| 亚洲欧美不卡高清在线| 亚洲a∨国产av综合av下载| 最新亚洲人成无码网站| 破了亲妺妺的处免费视频国产| 四虎影视精品永久免费网站| 国内精品99亚洲免费高清| 337p日本欧洲亚洲大胆精品555588 | 亚洲天堂免费在线视频| 日韩成人毛片高清视频免费看| 久别的草原电视剧免费观看| 亚洲精品二区国产综合野狼| 亚洲综合激情视频| 青娱分类视频精品免费2| 久久精品国产亚洲7777| 91午夜精品亚洲一区二区三区| 在线永久看片免费的视频| 亚洲乱码中文字幕手机在线 | 99久久久国产精品免费牛牛 | 亚洲综合激情五月丁香六月| 日韩在线免费播放| 亚欧乱色国产精品免费视频| 狠狠亚洲婷婷综合色香五月排名| 无码一区二区三区免费| 国产精品亚洲片夜色在线| 国产大片51精品免费观看| 三级毛片在线免费观看| 亚洲图片校园春色| 久草福利资源网站免费| 亚洲人成7777| 亚洲一级黄色视频| 最近最新高清免费中文字幕| 亚洲精品无码久久久久APP| 91麻豆国产自产在线观看亚洲| 18女人腿打开无遮掩免费| 亚洲AV综合色区无码一二三区| 一级毛片aaaaaa免费看| 亚洲女女女同性video|