This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 220443 - Could not find the main class:filename.FileName. Program will exit
Summary: Could not find the main class:filename.FileName. Program will exit
Status: RESOLVED INCOMPLETE
Alias: None
Product: java
Classification: Unclassified
Component: Project (show other bugs)
Version: 7.2
Hardware: PC Windows 7 x64
: P3 normal (vote)
Assignee: Tomas Zezula
URL:
Keywords: ARCH, REGRESSION
Depends on:
Blocks:
 
Reported: 2012-10-19 17:53 UTC by dotjoselric
Modified: 2012-10-25 12:45 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description dotjoselric 2012-10-19 17:53:56 UTC
I'll try to write in the most clearly english as possible.
3 days ago I returned to programming in java. I used to wrote my codes and projects in NetBeans 6.9.1 (or older) and it works well, but now I try to do very simple applications on NetBeans 7.2 and that gives me the following error when I do double click in File.jar: Could not find the main class:filename.FileName. Program will exit
Searching on google, some people say that is because the CLASSPATH is not setted, but I had already set all the Local Variables correctly (CLASSPATH, PATH, JAVA_HOME and JRE_HOME).
I try to downgrad to NetBeans 7.1.2 and the error still. Finaly I tryed NetBeans 6.9.1 and rewrite all projects that I have tried on the NetBeans 7.2 and 7.1.2 and it works perfectly.
In other forums somepeople say the error could be in manifest.nf, but I had looked the manifest.nf in all of those versions and the code doesn't changed.
The wierd thing is that the file run when I do java -jar FileName.jar, but not when I do double click on project that was created by NetBeans 7.2 or 7.1.2
Resume: NetBeans 7.2 and 7.1.2 gives me the following error when I double click on FileName.jar: Could not find the main class:filename.FileName. Program will exit
All my Local Variables is setted, program run when I do java -jar command.
And just by saying, I tryed that in a Fedora KDE 17 64bits also but doesn't works.

Can someone explain? The only problem that I can think is about NetBeans 7 version and 64bits architecture.
Comment 1 Theofanis Oikonomou 2012-10-19 18:02:31 UTC
Did you try to import old settings from 6.9.1 into 7.2 and something did not work as expected? From your description sounds that you did not. Please, reopen describing the type of project you are trying to open.
Comment 2 dotjoselric 2012-10-19 18:13:51 UTC
(In reply to comment #1)
> Did you try to import old settings from 6.9.1 into 7.2 and something did not
> work as expected? From your description sounds that you did not. Please, reopen
> describing the type of project you are trying to open.

Thats the first time I install NetBeans in THIS PC. I used to work with NetBeans 6.9.1 in my older PC.
I have tried in a lot of projects, but anyone works. The last one was a very simple. It was just a frame with a JButton and when you click on it you put this code: JOptionPane.showMessageDialog(null,"O botão está funcionando");
It has the FClick.java and Main.java.
and the Main.java is:

package projetoclick;

public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new FClick().setVisible(true);
            }
        });
    }

}
Comment 3 Theofanis Oikonomou 2012-10-19 18:33:56 UTC
ok so this is not an issue with importing settings. re-assigning for evaluation.
Comment 4 Tomas Zezula 2012-10-25 12:45:48 UTC
The project is started from the Windows explorer by double click not from the IDE, right?
Can you confirm this? If so it's in fact the same as running the program using the java -jar jarfile.jar.
It's important that that the JRE is set correctly and the jar contains all needed metadata. It has to have the main class attribute. The IDE is adding such an attribute for project created as a java application.
Can you attach a simple jar file which is not executed? I need to verify if it's a problem in JDK set up or the jar file has no  required attributes. If you can please attach also nbproject folder of the project which generated the jar file.
Thanks!