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).

Similar Messages

  • 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....

  • 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.

  • Problem in file association and main-class in JWS

    Hello , all
    I have a problem in JWS with file association and main-class. I have a java application that has two entry classes, one is appmain.class that is required to launch from web, and the other is player.class that is required to launch when user double-click the .abc extension file.
    In JWS 5.0+, there is a association element in JNLP syntax that can be used to make the file association with .abc extension. But how can I declare the main-class in JNLP file?
    If I declare the application-desc element as <application-desc main-class="player">, the player.class will be launched from web. But if I declare it as <application-desc main-class="appmain">, the .abc extension wil be associated to the appmain.class.
    Does anyone know how to solve this problem? Thank you for your kindly help.

    One way is to define a third main that refers
    to the other two, as appropriate. E.G. if the
    web based main does not include -open as
    its arguments, it is easy.class WebStartSpringboard {
      /** Call web based main unless args include -open. */
      public static void main(String[] args) {
        if (args[0].equals("-open") ) {
          OpenFileBasedClass.main(args);
        } else {
          WebBasedClass.main(args);
    }Other measures might be taken for a situation
    where the web based version does include a
    -open argument.

  • 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 with manifest file and Plateau LMS

    I have published a course with a quiz in SCORM 1.2 and tried
    to upload to a Plateau LMS.
    It seems that a "page cannot be found" message is the result
    after upload and we try to launch the course. The course works
    outside the LMS (when run locally on my computer).
    The Plateau LMS support team tried to help, and found the
    following: "There is something wrong with this manifest, though I
    cannot ascertain what that is exactly. Most of the file name is in
    the parameter field, which is causing the launch path to look like
    this:
    /content/apmm/cbcgis/mars/BRTMAIN/MARS?BRT%20Maintenance%20Template_%2020080226.htm=
    Everything in the parameters field is placed after the
    filename in a URLencoded querystring after the question mark that
    you see above. it should look like this:
    /content/apmm/cbcgis/mars/BRTMAIN/MARS BRT Maintenance
    Template_ 20080226.htm"
    Can anyone please help resolve this, or have any advice?
    This is the first time we have tried uploading Captivate
    courses to this LMS, and we have been having problems with the
    manifest file in general. I have looked at all the material I can
    find on publishing and the manifest file, but cannot seem to
    resolve my issue.
    Thanks
    Warwick

    Warwick,
    I have had this error with an Authorware set of SCORM files
    when my LMS was looking for index.htm and I had named it index.html
    - you wouldn't think that would cause an error but it did. I would
    be more than happy to package a Captivate file of just a few
    screens that works on my LMS (which is Learn.com's Learning
    Center), and send you the SCORM files to test... That could be a
    start anyhow. I will send you a private msg. with my e-mail
    id.

  • Jar files and Inner classes..

    I am trying to compile a java source file of a class that has an inner class.. using GNU Make. I am not sure if the .jar file is packing properly, because I get an error :
    Exception in thread "main" java.lang.NoClassDefFoundError: Airport$PortCode
            at Airport.getCode(Airport.java:133)
            at Airport.test1(Airport.java:228)
            at Airport.run(Airport.java:241)
            at Airport.main(Airport.java:255)where Airport.class is the main class and Airport$PortCode is an inner class of it (it is not static and is declared public)
    it works when I use it via "java Airport" but again i get the above error when I run with "airport.jar"
    thanks for you help

    I tried to test it on UNIX, but it replied to my
    commandUh, I am not so lucky to have a UNIX license (and don't see the need). Possibly the find on UNIX is different from GNU's find.
    find: path-list predicate-listUse backticks: The output of the command between backticks is used as the value for the shell variable. Possibly it could be the case that your find program does not allow the omission of the path list, then just make it:
    CLASSES=/home/here/there/project/classes
    `find $CLASSES -name "*.class"`Execute this command and the output of the command executed can be used as a return value.
    -name "*.class"look for all files ending on name.
    You can always do:
    $ man find (man is great)
    or
    $ info find>
    >
    >
    JARCLS    = `find -name "*.class"`

  • JSP, Servlet, and Java Classes location in Tomcat

    In tomcat, I want to know JSP files, Servlets, and Java classes
    should put in different locations:
    I put web.xml in the following:
    C:\jakarta-tomcat-4.1.30\webapps\proj1\WEB-INF
    I put all JSP files in the following:
    C:\jakarta-tomcat-4.1.30\webapps\proj1
    I put all servlet files in the following:
    C:\jakarta-tomcat-4.1.30\webapps\proj1\WEB-INF\classes
    I put all Java classes in the following with package proj1:
    C:\jakarta-tomcat-4.1.30\webapps\proj1\WEB-INF\classes\proj1
    When I execute JSP files, it has HTTP error 404, file not found.
    The content of web.xml is:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
    <display-name>proj1</display-name>
    <description>
         proj1
    </description>
    <servlet-mapping>
    <servlet-name>invoker</servlet-name>
    <url-pattern>/*</url-pattern>
    </servlet-mapping>
    </web-app>
    Please advise. thanks!!!

    <servlet-mapping>
    <servlet-name>invoker</servlet-name>
    <url-pattern>/*</url-pattern>
    </servlet-mapping>
    </web-app>Where's the servlet definition that maps to "invoker"?

  • Keywords in Master file and AP database-- Export Problem.

    I believe that I have a conflict with keywords. I believe that I have "baked in" keywords by writing IPTC to the Master files and then added more keywords which I am guessing are in the Aperture database and not "baked in". When I then look at exported images using the XMP sidecar file with Adobe Bridge all of the keywords do not show up. I want to experiment with Lightroom and I want all of the keywords.
    My process has been:
    1. Add keywords to images from the keywords panel.
    2. Write the IPTC metadata to the master files.
    3. Add more keywords to the images from the keywords panel.
    4. Export the images using the File/Export Masters/Create IPTC4XMP sidecare file.
    5. Look at the exported images in other applications (Bridge and PhotoMechanic).
    How can I export using XMP sidecar files and have ALL the keywords be exported???
    DickB

    Yes, this is a known problem; sqldev distinguishes between the Constraint and the Index although the former implies the latter...
    Regards,
    K.

  • Drag the 100 files and drop at treenode problem

    < Problem >
    I drag 20 files & drop those at one Treenode,
    Now, those files got transparent background color
    and stay on the treenode for a while and then disappear.
    to the right--side--of Panel, where it should be.
    --> Possible solution for this?
    Please, let me know.

    Please post a small, compilable and runnable example of what your problem is

  • HT1386 Never have had a problem synching both of my iPhones with my PC, specically Outlook files, and now having a problem.

    Never have had a problem synching both of my iPhones with my PC, specically Outlook files, now having a problem. It goes thru the whole process and shows completed, doesn't add any recent events posted to my PC calendar. Should I delete and reinstall iTunes?

    think the current itune version removed the feature and that you should use iclouds to sync your outlook stuff and your ios
    but read they will be adding the direct sync from itunes again in the next version of itunes or something like that
    for now just use icloud it's free and easy to setup

  • Clarification of JAR file and separate classes

    Hi all,
    I wanted to clarify a basic question. When do we club all classes to make a JAR file? For instance, in a web app with servlets, had all the servlet classes been put into a single JAR file, would that work? I know that woudn't but why?
    Is JAR file like a single executable (.exe) file? So, when (which type of applications) do we need single JAR and when separate classes?
    thanks much

    Thanks, I've gone thru it. So, sounds like JAR file can be used for invoking app thru command line or from some other app or even running applet in a browser. It can not be used for a servlet or jsp application. Am I right?

  • Creative cloud is working but the webpage cannot find the files and returns a SERVER PROBLEM

    What is wrong since the latest updates of Creative Cloud ??
    The upload is working fine but the Webpage is mostly not reachable and returns a SERVER error.

    I always use the app on my iMac, since more then one year.  The Creative Cloud is then Syncing my files.
    After that I can distribute by making a public link, but since the updates, I can see my folders on the web, but if I enter a folder, then comes a SERVER error.
    In my synced folder on the iMac, the files are marked with the green v whats means, the file is synced withe the cloud.
    Our system is not overloaded, I hev tested it with other dropbox and other cloud sites.

  • Loaded Trial Vesion of Acrobat Pro and it wont open files and I cant locate on my computer

    I did the sign up, agreed with everything and it doesn't seem to be totally loaded. Tried to download again and it says it is on my computer. At a loss....any help?

    Mac or WIndows?
    What exactly happens when you try to open a PDF file?

Maybe you are looking for