简体   繁体   English

创建jar时类路径未写入MANIFEST.MF文件

[英]Class-Path not getting write to MANIFEST.MF file on jar creation

I need to create a jar file I did the steps as follows: 我需要创建一个jar文件,我按以下步骤进行操作:

C:\TIPL\GCST>javac -classpath lib/xbasej-20091203.jar Test.java

C:\TIPL\GCST>jar cfm MyJar.jar manifest.txt Test.class

My manifest.txt file as follows: 我的manifest.txt文件如下:

Main-Class: Test 
Class-Path: commons-logging-1.1.1.jar xbasej-20091203.jar

My Test.java as follows: 我的Test.java如下:

import org.xBaseJ.DBF; 

public class Test 
{ 
public static void main(String args[]){ 

try{ 

//Open dbf file 
DBF classDB=new DBF("Class.dbf"); 
System.out.println("here"); 
} 
catch(Exception e){ 
} 

} 
}

I am getting created the jar file , but when I extract it and inside my Manifet.MF file it looks like this: 我正在创建jar文件,但是当我将其解压缩到Manifet.MF文件中时,它看起来像这样:

Manifest-Version: 1.0
Created-By: 1.8.0_25 (Oracle Corporation)
Main-Class: Test 

It is not getting the class-path append to it. 它没有将类路径追加到它。 Due to this when I run my jar file I am getting errors? 因此,当我运行jar文件时,出现错误了吗? How can I solve this? 我该如何解决? What is the reason the classpath not getting append on MANIFEST.MF 类路径未在MANIFEST.MF上追加的原因是什么?

In manifest text after putting your contents you must put an extra space into it. 在清单文本中放置内容后,必须在其中添加多余的空间。 So Do an Enter after adding all contents in manifest.txt 因此,在manifest.txt中添加所有内容后,请执行Enter

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM