13 Replies Latest reply on Jul 31, 2009 5:29 AM by 807581

    Netbeans 5.5 manifest.mf does not contain main, classpath

    807581
      I imported an project from Eclipse to NetBeans 5.5. In Eclipse, I would update manifest.txt before I exported the jar and it worked correctly.

      When I build the project the manifest.mf contains only:
      Manifest-Version: 1.0
      Ant-Version: Apache Ant 1.6.5
      Created-By: 1.6.0_01-b06 (Sun Microsystems Inc.)
      No Main-Class: , Class-Path: or other manifest files.

      Project -> Properties -> Run contains package.MyMain Class

      What did I miss when I imported the file?
        • 1. Re: Netbeans 5.5 manifest.mf does not contain main, classpath
          807581
          - Did you use the 'Eclipse Project importer' module (http://www.netbeans.org/kb/articles/import-eclipse.html) to perform the import?

          - nbproject/project.properties has an entry called 'manifest.file' that points to the manifest file being used. Perhaps you can try manually editing the manifest file. (Automatic import would of course be better...) Have you tried editing manifest.file?
          • 2. Re: Netbeans 5.5 manifest.mf does not contain main, classpath
            807581
            I imported the project from Eclipse using the "Eclipse Project Importer"

            When I checked the nbproject/project.properties file, I found no reference to any manifest* entry.

            I could not find a way to change the build\meta.inf\manifest.mf file from the IDE, it opened as a read-only file.

            Additional suggestions would be appreciated.
            • 3. Re: Netbeans 5.5 manifest.mf does not contain main, classpath
              807581
              You should be able to open the manifest file for editing, from the 'Files' tab in the navigator window. Can you try manually editing the file in files view?
              • 4. Re: Netbeans 5.5 manifest.mf does not contain main, classpath
                807581
                When I open the file in "files" view, it opens as a read-only file. I opened the files-properties dialog box for the file and did not see an option to make it writable.

                I hope I don't need to leave the IDE and use jar from the command line to correct the file, but at this time I don't see another solution.

                I don't understand why the manifest file is not being generated correctly.
                • 5. Re: Netbeans 5.5 manifest.mf does not contain main, classpath
                  807581
                  I haven't tried an eclipse import; but when i created a standard project, i notice that manifest.mf is writable and i am able to edit the file in the ide.

                  One possibility is that the import failed for some reason during some operations (which might have left the manifest in readonly mode). You may want to check the <userdir>/var/log/messages.log file to see if there were any error messages and/or stacktraces that may have been output by the import process.

                  Or, if you feel the import was more or less okay but may have had some minor issues that can be corrected manually, you may choose to do so. If the changes required are one-time changes, then it would make sense to make manifest writable and edit the changes outside of the ide; and fix other errors as you do.
                  • 6. Re: Netbeans 5.5 manifest.mf does not contain main, classpath
                    807581
                    I created a new project, copied my classes to the new project and compiled it. The manifest was generated correctly.

                    I noted that when I looked in MyProjects\nbproject\.project.properties the main.class=biz.myCompany.myProject.mainClass and
                    manifest.file=manifest.mf were set correctly.

                    I wonder what made the project import incorrectly. Perhaps it is the MyEclipse plug-in in eclipse??

                    icesurfer.
                    • 7. Re: Netbeans 5.5 manifest.mf does not contain main, classpath
                      807581
                      Glad to know you were able to workaround the problem by manually creating the project.

                      Regarding the eclipse importer module failing in NetBeans:
                      - It could be that the eclipse project that you have uses some advanced features of eclipse that are not supported by the importer. (I haven't worked with eclipse so am not aware of MyEclipse plugin...)

                      - The <nb_user_dir>/var/logs/messages.log is the file where the importer should have recorded any errors that it might have encountered. (It is possible that some errors are not recorded, which would be a bug in the importer module...)

                      - If you are still interested in diagnosing why the import failed, you may want to file an issue for this: http://qa.netbeans.org/bugzilla/reportbug.html :
                      component value to be used: ide
                      subcomponent value to be used: eclipse project import
                      It would be nice if you can include the original project as an attachment so that engineers can take a look at it.

                      - Since netbeans is an opensource project, you also have the option of downloading the source and debugging it yourself !! The following are some pointers that have more info on this:
                      http://nbbuild.netbeans.org/building-netbeans-trunk.html
                      http://www.netbeans.org/community/sources/
                      http://www.netbeans.org/source/browse/ide/projectimport/src/org/netbeans/modules/projectimport/
                      http://www.netbeans.org/community/contribute/
                      • 8. Re: Netbeans 5.5 manifest.mf does not contain main, classpath
                        807581
                        Try setting the main class ( under Project node -> Properties -> Run -> Main Class ) after importing but before your first build.
                        • 9. Re: Netbeans 5.5 manifest.mf does not contain main, classpath
                          807581
                          I had the same issue when importing from JBuilder, the same solution worked for me. Thanks.
                          • 10. Re: Netbeans 5.5 manifest.mf does not contain main, classpath
                            807581
                            Hello All!
                            I've just spent an entire day with a similar problem, after figuring it out i felt i had to share this for anyone else that may find themselves stuck in the same spot.
                            My Netbeans is version 6.01, and my problem was that, if in the root directory of your project there does not exist a (generic) manifest.mf file, then Netbeans does not generate a manifest.mf file correctly in the build process, and provides a rather blank one in your final jar file. It will have the typical comments, but lacks the Main-Class argument, even thou it is correctly spelled out in the build.xml file. Adding the manifest.mf file to the root of my project folder, caused Netbeans to correctly build my executable jar file correctly.

                            Manifest-Version: 1.0
                            Ant-Version: Apache Ant 1.7.0
                            Created-By: 10.0-b19 (Sun Microsystems Inc.)
                            X-COMMENT: Main-Class will be added automatically by build

                            p.s. don't forget the last line must be an empty line with carriage return.

                            Hope this helps.
                            • 11. Re: Netbeans 5.5 manifest.mf does not contain main, classpath
                              807581
                              Yeah that, and also I needed to add the following line in project.properties (File view):

                              manifest.file=manifest.mf

                              The line comes after "main.class=".

                              Hope that helps in fixing the problem.
                              • 12. Re: Netbeans 5.5 manifest.mf does not contain main, classpath
                                807581
                                The problem occurs on different occasions. I had a project started as "Java Class Library" to which I added a main class. The jar would not run and exit with the "Main class not found" error message.
                                Editinf the project.properties and the manifest file as described solved the problem.

                                Thanks for the input.
                                • 13. Re: Netbeans 5.5 manifest.mf does not contain main, classpath
                                  807581
                                  hi
                                  as you say to add line in manifest.but i am not able todo this it is saying it is read only file plz tell me correct reason behind it.