Simple Query, Manifest file, Jar, Main-Class

Hello :P thanks for reading my post.
I compiled a java file which gave me:
*.class
*$1.class
Then I created a jar file which i want to run when a user clicks on a link or button ect.
I have the latest SDK and the -e mod did not exist :( so i used cfm with a manifest.txt file.
I've tried using the following in my index.html file to run the hello world Swing application:
<html>
<head> <title>HelloWorldSwing</title>
</head>
<body>
<h1>my heading</h1>
<applet code=HelloWorldSwing codebase=classes archive=HelloWorldSwing.jar
width=695 height=525>
</applet>
</body> </html>
It gives me an error saying it cant access the class HelloWorldSwing.
I belive it might be my Main-Class: classname in the Manifest.txt file.
*I can't get my head around the format of classname.
I was wonder if a kind soul would tell me what my classname is ment to look like. I've read a few examples and I just don't seem to grasp the concept.
Mabey i'm going about the whole thing the wrong way.
More info:
HelloWorldSwing.java contains the following code:
* HelloWorldSwing.java requires no other files.
import javax.swing.*;
public class HelloWorldSwing {
* Create the GUI and show it. For thread safety,
* this method should be invoked from the
* event-dispatching thread.
private static void createAndShowGUI() {
//Create and set up the window.
JFrame frame = new JFrame("HelloWorldSwing");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//Add the ubiquitous "Hello World" label.
JLabel label = new JLabel("Hello World");
frame.getContentPane().add(label);
//Display the window.
frame.pack();
frame.setVisible(true);
public static void main(String[] args) {
//Schedule a job for the event-dispatching thread:
//creating and showing this application's GUI.
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
}

The Main-class attribute in the manifest is for when you do java -jar myjar.jar. It has nothing to do with applets, where you specify the class in the HTML.
The format of the class name is package.classname.
Your problem is that HelloWorldSwing is a main program, not an applet. It has to extend java.applet.Applet.

Similar Messages

  • Manifest file and main class location problem

    my main class is in not in the root of the jar file, it is down a package tree structure, and whenever I run the jar it says
    Failed to load Main-Class manifest attribute from
    xxxxx.jar
    How do I specify the location of the main class? like this??
    Main-Class: com/Utilities/visual/Model
    thanks for your help.

    It should be
    Main-Class: com.Utilities.visual.Model
    and make sure your manifest file has an empty line at the end of your file (i.e. press enter after the last line in your manifest line).

  • Jar files and Main-Class headers

    I think I already posted this, but I can't find it on the forum...my apologies if it's already there and I'm just blind or something.
    I have a bunch of classes in the directory C:/chess/server , and I want to make a .jar file with these classes. The class with the main method is server/ChessServer.class . From which folder should I create a jar file with these classes, and how exactly should I label the Main-Class header in the manifest file? Also, what's the purpose of the "Name:" header?
    I know the topic is posted a lot, but I've tried many different ways and I can't get this to work. I get many variations on the "NoClassDefFoundError". I know the classes themselves are fine because they work perfectly when they're not in a .jar file.
    Thanks in advance!

    I tried that, and it still doesn't work. I used the command C:\chess> jar 0cmf manifest.mf MuChess.jar server . Manifest.mf is:
    Main-Class: server.ChessServer
    Sealed: true
    When I try to run it with C:\chess> java -jar MuChess.jar , I get:
    Exception in thread "main" java.lang.NoClassDefFoundError: server/ChessServer (w
    rong name: ChessServer)
    at java.lang.ClassLoader.defineClass0(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
    3)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:250)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:54)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:193)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
    When I unpack the file with my excraction utility, I get get two folders: One is "server", and contains all the files it should--including ChessServer--, and the other is "META-INF" and contains the following MANIFEST.MF file:
    Manifest-Version: 1.0
    Sealed: true
    Created-By: 1.4.1_03 (Sun Microsystems Inc.)
    Main-Class: server.ChessServer
    Any ideas?

  • Jar files and Main-Class attribute

    Sorry, I know there are other topics regarding this argument but none of them helped me solving my problem.
    I've tried a thousand time in every possible way, but I still can't run my application from a jar file. I've got a package called client, whose main class is called Client. The package contains a sub-package called Icons. I've put everything into a jar file and added this manifest:
    Manifest version: 1.0
    Name: client/
    Sealed: True
    Main-Class: client.Client
    But it won't work. I've tried to erase the Sealed part, I've tried "Main-Class: Client" and also "client/Client", I've tried putting into the jar the client directory and I've tried omitting it, but the answer is always the same:
    Failed to load main-class header etc.
    Can anyone help me? Please, I'm almost desperate!
    Thanks

    Here's the verbose-mode description of what I did.
    jar -cfv client.jar clientaggiunto manifesto
    aggiunta in corso di: client/(in = 0) (out= 0)(archiviato 0%)
    aggiunta in corso di: client/.nbattrs(in = 767) (out= 310)(compresso 59%)
    aggiunta in corso di: client/Client.class(in = 533) (out= 340)(compresso 36%)
    aggiunta in corso di: client/Client.java(in = 288) (out= 140)(compresso 51%)
    aggiunta in corso di: client/ClientForm$1.class(in = 691) (out= 383)(compresso 44%)
    aggiunta in corso di: client/ClientForm$10.class(in = 678) (out= 380)(compresso 43%)
    aggiunta in corso di: client/ClientForm$11.class(in = 689) (out= 385)(compresso 44%)
    aggiunta in corso di: client/ClientForm$2.class(in = 686) (out= 379)(compresso 44%)
    aggiunta in corso di: client/ClientForm$3.class(in = 686) (out= 381)(compresso 44%)
    aggiunta in corso di: client/ClientForm$4.class(in = 686) (out= 380)(compresso 44%)
    aggiunta in corso di: client/ClientForm$5.class(in = 686) (out= 383)(compresso 44%)
    aggiunta in corso di: client/ClientForm$6.class(in = 718) (out= 399)(compresso 44%)
    aggiunta in corso di: client/ClientForm$7.class(in = 718) (out= 400)(compresso 44%)
    aggiunta in corso di: client/ClientForm$8.class(in = 718) (out= 399)(compresso 44%)
    aggiunta in corso di: client/ClientForm$9.class(in = 718) (out= 398)(compresso 44%)
    aggiunta in corso di: client/ClientForm.class(in = 33070) (out= 13510)(compresso 59%)
    aggiunta in corso di: client/ClientForm.form(in = 131398) (out= 4521)(compresso96%)
    aggiunta in corso di: client/ClientForm.java(in = 73435) (out= 6863)(compresso 90%)
    aggiunta in corso di: client/Icons/(in = 0) (out= 0)(archiviato 0%)
    aggiunta in corso di: client/Icons/brick.gif(in = 1044) (out= 1049)(compresso 0%)
    aggiunta in corso di: client/Icons/corpo.gif(in = 4011) (out= 3400)(compresso 15%)
    aggiunta in corso di: client/Icons/door.gif(in = 1092) (out= 1097)(compresso 0%)
    aggiunta in corso di: client/Icons/floor.gif(in = 1102) (out= 1107)(compresso 0%)
    aggiunta in corso di: client/Icons/mappa.gif(in = 20901) (out= 20575)(compresso 1%)
    aggiunta in corso di: client/Icons/paesaggio.gif(in = 18962) (out= 18603)(compresso 1%)
    aggiunta in corso di: client/Icons/sole.gif(in = 7063) (out= 6546)(compresso 7%)
    aggiunta in corso di: client/Icons/trap.gif(in = 1062) (out= 1067)(compresso 0%)
    aggiunta in corso di: client/Icons/void.gif(in = 842) (out= 847)(compresso 0%)
    aggiunta in corso di: client/Listener.class(in = 1869) (out= 1136)(compresso 39%)
    aggiunta in corso di: client/Listener.java(in = 2296) (out= 708)(compresso 69%)
    aggiunta in corso di: client/manifesto.txt(in = 62) (out= 58)(compresso 6%)
    aggiunta in corso di: client/ScorciatoieDialog$1.class(in = 740) (out= 391)(compresso 47%)
    aggiunta in corso di: client/ScorciatoieDialog$PopupListener.class(in = 1579) (out= 773)(compresso 51%)
    aggiunta in corso di: client/ScorciatoieDialog.class(in = 3524) (out= 1638)(compresso 53%)
    aggiunta in corso di: client/ScorciatoieDialog.form(in = 8500) (out= 910)(compresso 89%)
    aggiunta in corso di: client/ScorciatoieDialog.java(in = 5676) (out= 1222)(compresso 78%)
    jar umf mainclass.txt client.jar[NOTE: mainclass.txt only contains the line "Main-Class: client.Client"]
    java -jar client.jarFailed to load Main-Class manifest attribute from
    client.jar
    I've also tried to manually create a MANIFEST.MF file that only contained the following lines:
    Manifest Version: 1.0
    Main-Class: client.Client
    guess what was the result?
    java -jar client.jarException in thread "main" java.io.IOException: invalid manifest format
    at java.util.jar.Manifest.read(Manifest.java:193)
    at java.util.jar.Manifest.<init>(Manifest.java:52)
    at java.util.jar.JarFile.getManifest(JarFile.java:158)
    >
    the same procedure with the addition of "Name: client/" before the main-class attribute generated the usual "Failed to load Main-Class manifest attribute" result. So now what?!? I'm getting crazy....

  • Runnable JAR, Main-Class, Class-Path and INDEX.LST

    Some funky finding, don't know whether this is a bug or a feature...
    I'm using
    java version "1.4.2_06"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_06-b03)
    Java HotSpot(TM) Client VM (build 1.4.2_06-b03, mixed mode)
    I observed follwing weired behaviour:
    If you have a JAR packed with your classes and define in the Manifest a Main-Class and a Class-path pointing to JARs in the same directory than the main JAR, example:
    Manifest-Version: 1.0
    Ant-Version: Apache Ant 1.6.2
    Created-By: 1.4.2_06-b03 (Sun Microsystems Inc.)
    Main-Class: main.Main
    Class-Path: activation.jar axis.jar commons-discovery.jar
      commons-logging.jar jaxrpc.jar log4j-1.2.8.jar mail.jar saaj.jar wsd
    l4j.jar junit.jarTHEN you should NOT have a META-INF/INDEX.LST file. This file is created for instance by ant jar when setting attribute index="true". Itt complies to the JAR standard and is used to find classes faster.
    If you have such a file then none of the classes of the "Class-Path" JARs will be found. At least that was true for me...
    Hope, I haven't bothered you with something commonly knwown. Just wanted to let you know, to avoid fighting againt JARs like I did for the last 3 hours..damn.
    Cheers,
    Peter

    Does anyone know if having a Class-Path in the manifest would ignore the system environment variable CLASSPATH?
    I'm seeing this in my set-up. I have an external jar file that can be seen if copied to <jre dir>/lib/ext, but when it's in another dir with the CLASSPATH pointing to it can't be found.
    My applet uses a number of jar files and I reference them in the manifest using the Class-Path entry. Does this supercede the environment variable??

  • Problem of  loading the Manifest file

    Hello Friends,
    I have developed a project in J2SE.I am creating a JAR file of it but I am facing a problem in doing that. My Problem is The Manifest File I have created is not loading by the JVM. I have created the Manifest file which contains the following code:
    Main-Class: secl/Login
    and save it with the name Login.mf in C drive where my project folder is also exists. Then run the following command:
    C:\>jar cvfm secl.jar Login.mf secl\*.class
    then, following error is shown:
    java.io.FileNotFoundException: Login.mf (The system cannot find the file specified)
    Then, I run the following command:
    C:\>reg query HKCR\jarfile\shell\open\command
    Then, I received the following msg:
    ! REG.EXE VERSION 3.0
    HKEY_CLASSES_ROOT\jarfile\shell\open\command
    <NO NAME> REG_SZ "C:\Program Files\Java\j2re1.4.1_03\bin\javaw.exe" -jar "%1" %*
    I think this msg says my files association is wrong. What is the meaning of this msg? My JAR file is created but Manifest file is not loading and main class is not read.Please help me about this.
    I am a self learner and there is no body here to help me.

    Hello Friends!
    I have successfully created the JAR file of my project with the Manifest File including my Main Class. I had just gave the following command:
    C:\>jar cfm secl.jar Manifest.txt secl/*.class
    and my jar file is created. But there is a problem, when I execute this jar file at command prompt by the following command:
    C:\>java -jar secl.jar
    the following error msg is shown:
    Exception in thread "main" java.lang.NoClassDefFoundError: secl/Login (wrong name: Login)
    And also when I execute it by double clicking it then the following error msg dialog box is shown:
    Could not find the main class.Program will exit!
    As you suggested, I gave the main class path in Manifest file as:
    Main Class: secl.Login
    but the same problem is still occurring.
    How can I solve this problem? Please help me.

  • Specifying  multiple classpath entries in manifest file

    HI all,
    I want to make one jar file executable so i have created the jar file with specifying manifest file including main-class & class-path.
    But my class-path is little over 75 bytes .There is restriction of entries should be only 70 lines.so jar file is not taking the last 6 bytes.
    I have specified multiple classpath entries but it is taking only last entiy only..
    How can i set the multiple class path entries in the manifest file?
    Thanks in Advance

    Classpath entries for a mainfest file should be other jar file names.
    Put them in the same or a sub directory as your main jar.
    See: http://java.sun.com/docs/books/tutorial/deployment/jar/downman.html

  • Running JAR files (Could not find the main class error)

    Hi all,
    I'm having a bit of a problem with my app. I created an application with the current Netbeans edition, containing multiple .class files, and a few .jar libraries that are needed too.
    Now I'm having problems with running the .jar that the Netbeans creates, so I figured I'd make a one on my own.
    Okay, this is what I have going on:
    C:\MyApp\ <--- root for the application
    C:\MyApp\src\ <--- this is where the .class files are
    C:\MyApp\lib\ <--- here are the .jar libraries which are needed
    C:\MyApp\jar.exe
    C:\MyApp\Manifest.txt
    Now I have a couple questions.
    1. Is it ok that the .class files all have a "package MyPackage; " thing in the beginning?
    2. How should I proceed on making the Manifest.txt file correctly? I have tried various different outputs and read a few topics here from how it should be done, but I just can't nail it. Currently my Manifest looks like:
    Main-Class: MyPackage/Myapp
    Class-Path: lib/xxx.jar lib/xxx2.jar lib/xxx3.jar
    Any help would be appreciated! Thanks.

    Oh, almost forgot:
    3. The right way to create a jar? I used this:
    C:\MyApp\jar cmf Manifest.txt MyJar.jar src\*.class
    And system is Windows XP.

  • JAR  file:      could not find the main class.

    I have been working with Java satisfactorily for about two years.
    Installed a bigger hard disk.
    Installed Windows XP.
    Downloaded java.
    Downloaded java jdk 1.6.0_07
    Downloaded java3d 1.5.2
    Downloaded Eclipse Ganymede.
    A new project, a new class with an existing and working java file. It did function in eclipse.
    Generated a jar file with:
    Export \ JAR FILE \ select files and the destination for the Jar file .....
    ... next...next filled the field Main Class
    This generates the jar files, which have worked before.
    And now the error: could not find the main class.
    Thand you for your help.

    Executing a jar file means it will not read from the CLASSPATH environment variable. I learnt this the hard way a few weeks ago and I had to resort to different measures to work around it.
    Your problem does sound weird, but check that the last line in your manifest file is a new line. If it's not, the manifest is not read and parsed correctly.
    To test, do this: remove everything from the manifest that you don't need, except the Manifest-Version and Main-Class attributes. Make sure the last line is a new line, and see if it works.
    Cheers

  • Failed to load Main-Class manifest attribute from jar

    I get this error when i try start a executable jar file:
    Failed to load Main-Class manifest attribute from
    even though i have a
    Main-Class: a.b.c.MyClass
    entry in the meta-inf/manifest.mft
    I also have a (rather long) "Class-Path:" entry preceeding the "Main-Class:" entry in the manifest. What's wrong?

    ant has a major problem with very long "Class-Path" entries in a manifest file.
    The ant manual states, that jars wrap lines in manifest files longer than 72 characters. They say it's not their fault, and they can't do anything about it...
    I need to make an executable jar file with a classpath of approx. 200 characters.
    When i use Netbeans to jar the project, everythings fine.
    But using ant, the Class-Path seems to get messed up and none of the external classes are found, even though the manifest looks just like the one generated by Netbeans and the jar contents are the same.
    One way to workaround this problem is by using a manifest like this:
    Class-Path: some.jar foo.jar
      someother.jar
      guesswhat.jar
    Main-Class: what.everPlease take note of the leading spaces on the second and third Class-Path line.
    But i don't think, there's any way to make ant create a manifest like that using the ant <manifest> tag, because you can only specify a single "Class-Path" attribute, empty attributes are not allowed and if you use ${line.separator} to break lines, the line will still get a hard break after 72 characters. D'uh!
    Looks to me like a case of denial.
    On the other hand, there's another good idea to be found at jakarta:
    http://jakarta.apache.org/commons/sandbox/hivemind/jakarta-hivemind/ant/ManifestClassPath.html
    I'm going to check tomorrow if this might solve the problem.
    Or is there some other magical ingredient missing in the ant generated jar, that the NetBeans generated jar has??
    The most interesting part is, that i can't even make the ant jar run properly, if i call
    java -classpath ... -jar myAnt.jar

  • Java can't find main class when manifest has certain JARs on it

    I recently wrote an Ant script that builds my application and jars it up, creating a manifest in the process. The manifest specifies the main class and a classpath that mentions other jars that exist in the same directory. Everything works as expected and I am able to run the program using "java -jar abc.jar".
    However, I recently started using classes in my program that come from a jar that should (according to the company I work for) reside in a central location rather than each application having its own copy. So, I changed my build script to reference those shared jars in a common location. But now when I run "java -jar abc.jar", I get a java.lang.ClassNotFoundException: com.example.Main. If I edit the jar's manifest and manually remove the new jars from the classpath, the ClassNotFoundException error goes away (although obviously that causes other problems.) Is there something about adding those new jars to the manifest classpath that would prevent Java from finding my main class? My manifest looks something like this and the last two jars (the ones with the absolute paths) are the jars that seem to be the root of the problem.
    Manifest-Version: 1.0
    Ant-Version: Apache Ant 1.7.0
    Created-By: 1.5.0_04-b05 (Sun Microsystems Inc.)
    Main-Class: com.uprr.app.rsa.Main
    Class-Path: acegi-security-1.0.6.jar commons-codec-1.4.jar commons-htt
    pclient-3.1.jar commons-lang-2.4.jar commons-logging-1.1.1.jar common
    s-pool-1.5.4.jar dom4j-1.6.1.jar jakarta-oro-2.0.8.jar jaxen-1.1.1.ja
    r jibx-run-1.2.1.jar joda-time-1.6.jar jsr173_1.0_api.jar log4j-1.2.1
    5.jar opensaml-1.1.jar spring-2.5.2.jar stax-api-1.0.1.jar wstx-asl-3
    .2.9.jar xmf-3.0.2.jar xmlsec-1.4.1.jar C:\software\tibco\ems\clients
    \java\jms.jar C:\software\tibco\ems\clients\java\tibjms.jarAny ideas?
    Brandon

    I still don't know why giving the absolute classpath entry like that would cause Java to be unable to find the jar's main class, but I did make an interesting discovery. If I give the absolute path without the drive letter, is able to find the main class again. Something like this won't work...
    Class-Path: C:\software\tibco\ems\clients\java\tibjms.jarBut something like this will...
    Class-Path: \software\tibco\ems\clients\java\tibjms.jarBut I'd still like to know why Java doesn't accept drive letters when running on a Windows machine. After all, what if my manifest needed to reference a jar that was on a different drive, like a network drive (since this whole problem came up as a result of shared common jars that need to exist outside of the project.)

  • Could not find Main Class while executing JAR

    Hello all,
    I am having a simple Jar file that contains one java class that merely displays a window. I am using NetBeans IDE to create the JAR file. When i execute this JAR file by double clicking on the file, it works fine on the machine. However, if i try to execute this same file on any other windows computer, it gives an error "Could not find the main class. Program will exit."
    In other words, the JAR file is only working on the computer that has NetBeans and JDK installed on. Not on any other machine. Although the other machines have the JAVA Virtual Machine installed.
    I would appreciated any help on this topic.

    I had the same problem (i.e. Message-Box with "Could not find the main class. Program will exit.")
    After insuring that the manifest contained a Main-Class: argument and that the argument pointed to the right class, I started the jar via java -jar myjar.jar and read the stacktrace, which is much better than the popup-window.
    In my case the error was, that the Main-Class could not be loaded due to another referenced class, which was not on the classpath. (i.e. it was not in the same jar-File and the manifest didn't include a Class-Path: argument.)
    After adding the correct Class-Path: argument in the manifest, the problem went away.
    I now have the following setup:
    myjar.jar and somethirdparty.jar in the same directory.
    myjar.jar contains a manifest which includes the lines
    Class-Path: somethirdparty.jar
    Main-Class: my.package.and.MainClassafter the normal Manifest-header.

  • ANT - Jar File include another Jar file and importing classes

    Here is the directory structure i have set up:
    FTPGetter
      \src
        \com
          \abc
            \ftpgetter
              - GUI.java
              - FTPGetter.java
              - Login.java
      \classes
      \include
        - ftpClient.jar
        - info.xml
      \jar
        - FTPGetter.jarThe code compiles file and can create a Jar file without errors. But when I execute the Jar file, I get
    java.lang.NoClassDefFoundError: com/abc/ftpclient/FTPwhich is a class that I import from the ftpClient.jar file in FTPGetter.java
    What gives?
    Here is my necessary build.xml code:
    <?xml version="1.0"?>
    <project name="FTPGetter" default="all">
      <property name="src.dir"        value="src"/>
      <property name="package.name"   value="com.abc.ftpgetter"/>
      <property name="package.dir"    value="${src.dir}/com/abc/ftpgetter"/>
      <property name="classes.dir"    value="classes"/>
      <property name="include.dir"    value="include"/>
      <property name="jar.dir"        value="jar"/>
      <property name="javadoc.dir"    value="docs"/>
      <property name="javadoc.title"  value="FTPGetter"/>
      <property name="javadoc.header" value="FTPGetter - By ABC XYZ [2005]"/>
      <property name="run.classname"  value="${package.name}.FTPGetter"/>
      <target name="init">
        <mkdir dir="${javadoc.dir}" />
        <mkdir dir="${classes.dir}" />
        <mkdir dir="${jar.dir}" />
      </target>
      <target name="all" depends ="compile,jar" />
      <target name="compile" description="Compile Java code" depends="clean, init">
        <javac srcdir="${package.dir}" destdir="${classes.dir}">
          <classpath>
            <!-- use the value of the ${classes.dir} property in the classpath -->
            <pathelement path="${classes.dir}" />
            <!-- include all jar files  -->
            <fileset dir="${include.dir}">
              <include name="**/*.jar"/>
            </fileset>
          </classpath>
        </javac>
      </target>
      <target name="clean" description="Clean up">
        <delete dir="${javadoc.dir}" />
        <delete dir="${classes.dir}" />
        <delete dir="${jar.dir}" />
      </target>
      <target name="jar" depends="compile">
        <jar jarfile="${jar.dir}/FTPGetter.jar" update="false">
          <fileset dir="${classes.dir}" includes="**/*.class" />
    <!-- Include xml file to read.-->
          <fileset dir="${include.dir}" includes="info.xml" />
    <!-- Include ftpClient in the jar file.-->
          <fileset dir="${include.dir}" includes="ftpClient.jar" />
          <manifest>
            <attribute name="Main-Class" value="com.abc.ftpgetter.FTPGetter" />
            <attribute name="Class-Path" value="include/ftpClient.jar"/>
          </manifest>
        </jar>
      </target>
    </project>

    nevermind I got that fixed now:
    had to get the build.xml code for the <target name="jar" depends="compile">so that it looks more like:
      <target name="jar" depends="compile">
        <jar jarfile="${jar.dir}/FTPGetter.jar">
          <zipfileset dir="classes" prefix="" />
          <zipfileset src="include/ftpClient.jar" />
          <zipfileset dir="${include.dir}" includes="info.xml" />
          <manifest>
            <attribute name="Main-Class" value="com.abc.ftpgetter.FTPGetter" />
          </manifest>
        </jar>
      </target>Keyword would need to be zipfileset.

  • Problem is when iam exporting the jar file the manifest file  chaning

    LogWriter.java
    MiniBrowser.java
    SendMail.java
    TestMiniBrowser.java
    iam running the site scope program ,program is running fine
    i add the mail.jar and activation.jar
    when iam Exporting the JAR file ,the Manifest files is changing with out classpath
    only showing the like this
    Manifest-Version: 1.0
    Sealed: true
    Main-Class: p1.TestMiniBrowser
    Actually i created the manifest files like this ..
    Manifest-Version: 1.0
    Sealed: true
    Class-Path: mail.jar activation.jar icsops.jar
    Main-Class: p1.TestMiniBrowser
    problem is when iam exporting the jar file the manifest file is changing then iam not able the run the jar file ..

    iam Useing Eclipse sdk3.1
    after exporing the jar the manifewst is canging but iam updating mauvally but when iam runingg the jar file
    D:\pavansitescope>set calsspath=%classpath%C:\j2sdk1.4.1_03\bin;.;
    D:\pavansitescope>set calsspath=%classpath%D:\pavansitescope\mail.jar;.;
    D:\pavansitescope>set calsspath=%classpath%D:\pavansitescope\activation.jar;.;
    D:\pavansitescope>set calsspath=%classpath%D:\pavansitescope\mail-plugin.jar;.;
    D:\pavansitescope>java -jar icsops.jar
    Arguments Usage:
    1. URL link
    2. From Address
    3. To Addresses (seperated by comma)
    4. Mail Server Host Name
    D:\pavansitescope>java -jar icsops.jar [http://69.27.230.104/SiteScope/accounts/l]
    ogin5/htdocs/Progress.html [[email protected]|mailto:[email protected]] [[email protected]|mailto:[email protected]] HYDMA
    IL03
    Exception in thread "main" java.lang.NoClassDefFoundError: javax/mail/MessagingE
    xception
    at p1.TestMiniBrowser.start(TestMiniBrowser.java:42)
    at p1.TestMiniBrowser.main(TestMiniBrowser.java:156)
    D:\pavansitescope>

  • How to modify the Manifest file in the JAR file

    Hi guys,
    i am having a JAR which contains one Manifest file and 10 class files.
    actually i want to do some changes on the manifest file, but by using the ,
    " jar -cmf new_manifest_file jar_fileName all_class_files " option i am able to modify the manifest file by repacking the .class also.
    i want to modify the manifest file without disturbing the existing class files in the JAR file.
    Thanx in advance.............! ! ! !
    bye,
    subbu

    yeah, that is correct.
    my doubt is,
    Is it possible to modify the Manifest file which is inside the jar file, by without disturbing the Class files.
    --Subbu                                                                                                                                                                                                                                                                                                                           

Maybe you are looking for