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 48250 - [40cat] Problems with setting the main class
Summary: [40cat] Problems with setting the main class
Status: CLOSED WORKSFORME
Alias: None
Product: java
Classification: Unclassified
Component: Project (show other bugs)
Version: 4.x
Hardware: PC Windows XP
: P3 blocker (vote)
Assignee: Jiri Rechtacek
URL:
Keywords:
Depends on:
Blocks: 41537
  Show dependency tree
 
Reported: 2004-08-31 15:45 UTC by Milan Kubec
Modified: 2004-10-07 15: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 Milan Kubec 2004-08-31 15:45:01 UTC
From NetCAT participant:

[JDK 1.4.2]
I still have problems to get my project running in
NB4.0.

(1)
I set the project's main class using Project
Properties --> Running Project --> Main Class -->
Browse
NB40 finds my main class. I select it and press
ok. No problem so far.

When I press F6 now, NB tells me that my project
does not have a  main class and pops up the
browsing window again.
It finds my main class, I select it again
resulting in a fresh browsing window popping up
and so on endlessly.

(2)
Then I tried the following: I typed in a wrong
package name for my main class.
Then I press F6. In this case NB compiles my
project and tries to run it.
It stops with:

init:
deps-jar:
Compiling 533 source files to
C:\development\wines\simulator\netbeans\simulator\build\classes
Note: Some input files use or override a
deprecated API.
Note: Recompile with -deprecation for details.
compile:
run:
java.lang.NoClassDefFoundError:
main/simulation/SimulatorMain
Exception in thread "main" 
Java Result: 1
BUILD SUCCESSFUL (total time: 12 seconds)

This looks fine for me, because the class truly
does not exist.

(3)
My question is: Why does NB not start to compile
and run my project as above in (2) when I set the
main-class 
correctly but instead complains about not having
the main class set at all?

Are there any special requirements for the
main-class or the main-method in it?
NB4.0 finds my main class, but does obviously not
accept it.

BTW, I do not have any problems with my project in
NB3.6.
Comment 1 voigtje 2004-08-31 16:02:37 UTC
The project was created with

New Project --> Standard --> Java Project with Existing Sources

Unfortunately, I can not sent my project over.
I'll try to find a reproducible subset.
Comment 2 Milan Kubec 2004-09-01 08:06:23 UTC
Don't you have varargs in your main method? Just in case your project
would use 1.5 platform. See #47801.
Comment 3 Jiri Rechtacek 2004-09-03 15:19:50 UTC
The processing of main classes has been changed after NB4beta (see
issue 47481), it works for me. Reopen if any you case doesn't pass and
attach it, please.
Comment 4 voigtje 2004-10-07 15:45:39 UTC
This problem does not occur anymore with beta2 on my projects.