<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
    主站蜘蛛池模板: 久久国产亚洲观看| 亚洲欧洲自拍拍偷综合| 亚洲AV无码一区二区大桥未久| 99在线观看视频免费| 亚洲国产成人片在线观看无码| 中文字幕亚洲综合精品一区| 99精品视频免费| 亚洲国产精品VA在线看黑人 | 国产精品亚洲AV三区| 免费观看的毛片手机视频| 亚洲精品国产av成拍色拍| 国产乱人免费视频| 一区二区三区免费视频播放器| 丁香五月亚洲综合深深爱| 国产精品亚洲精品青青青| 岛国大片免费在线观看| 亚洲综合另类小说色区色噜噜| 好吊色永久免费视频大全 | 亚洲欧洲春色校园另类小说| 无码区日韩特区永久免费系列 | a级日本高清免费看| 亚洲AV无码专区国产乱码电影| 99久在线国内在线播放免费观看| 亚洲福利电影在线观看| 免费爱爱的视频太爽了| 粉色视频成年免费人15次| 亚洲中文字幕无码不卡电影| 免费国产成人18在线观看| 亚洲成人免费在线观看| 国产无遮挡吃胸膜奶免费看| 一个人免费观看日本www视频| 亚洲成在人线av| 最近最新中文字幕完整版免费高清| 激情小说亚洲色图| 亚洲高清国产拍精品26U| 欧洲乱码伦视频免费| 日韩毛片在线免费观看| 亚洲午夜视频在线观看| 国产黄色片在线免费观看| a级毛片免费高清毛片视频| 亚洲一级特黄特黄的大片|