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.
When running a project in NetBeans, that has a main class set which exists in one of its JAR libraries, the Profiler can't seem to determine the main class. I get an error dialog which says: "Project <PROJECT> does not have a main class set correctly. Select the main class for profiling:" and the dialog provides me with a list of classes within the project which have main methods. I suspect that upon Profiler execution, the Profiler sees that the main execution class does not exist in the current project, and doesn't know what to do. It should also be noted that I have only recently been having this problem. I've even tried unintegrating the profiler from the Project, and reintegrating, but to no avail.
Could you be more specific about the project type? I've tried this with the j2se projects types and it works just fine, given you had selected the main class in the project properties dialog.
Without requested information for long time - INVALID. We can't do anything in this case. Reporter, please add requested information and reopen issue. Thanks in advance.
Reopening. The problem is that profiler only supports main classes which are within the source tree. My main class is in a jar listed in Run libraries. It is correctly set within project properties (I can run the project just file). But when I try to profile a dialog show up asking me to set the main class.
Created attachment 105361 [details] Working app with main class in jar NetBeans Build 201101250001 I am not able to reproduce it using the attached sample project. Can you attach the project causing you the troubles?
Waiting for input ...
Can you attach the LibApp.jar, too?
I'm afraid I can't upload the project. FWIW, I cannot even select the main class from (any) jar. I had to manually type the main class in project properties. I only get offered classes which have main() from the source tree.
Created attachment 105369 [details] LibApp.jar Sorry, slipped out :(
Ok, I put the jar somewhere else, and updated project.properties. Did the profiler integration, and... it doesn't work. Same error.
Which version of NetBeans are you using? I just entered the main class manually (the browse for main class doesn't work for dependencies as you pointed out) and everything worked just fine. Anyway, profiler uses the project information to resolve the main class - so if running the project works fine so should profiling, there is no reason it shouldn't.
This is a 6.9.1 install. Here are the versions of profiling modules: org.netbeans.lib.profiler/1 [1.10.2 201007282301] org.netbeans.lib.profiler.common/1 [1.10.2 201007282301] org.netbeans.lib.profiler.charts/1 [1.6.1 201007282301] org.netbeans.lib.profiler.ui/1 [1.9.2 201007282301] org.netbeans.modules.profiler.utilities/1 [1.13.1 201007282301] org.netbeans.modules.profiler.projectsupport [1.8.1 201007282301] org.netbeans.modules.profiler.attach/1 [1.7.1 201007282301] org.netbeans.modules.profiler.oql/0 [0.5.1 201007282301] org.netbeans.modules.profiler.selector.spi/1 [1.11.1 201007282301] org.netbeans.modules.profiler.selector.ui/1 [1.7.1 201007282301] org.netbeans.modules.profiler/1 [1.17.2 201007282301] org.netbeans.modules.profiler.j2ee.tomcat/1 [1.11.1 201007282301] org.netbeans.modules.profiler.j2ee.sunas/1 [1.11.1 201007282301] org.netbeans.modules.profiler.j2ee.jboss/1 [1.11.1 201007282301] org.netbeans.modules.profiler.j2ee.generic/1 [1.11.1 201007282301] org.netbeans.modules.profiler.nbmodule/1 [1.11.1 201007282301] org.netbeans.modules.profiler.freeform/1 [1.11.1 201007282301] org.netbeans.modules.profiler.attach.impl/2 [1.7.1 201007282301] org.netbeans.modules.profiler.j2ee.weblogic/1 [1.11.1 201007282301] org.netbeans.modules.profiler.selector.java [1.5.1 201007282301] org.netbeans.modules.profiler.j2se/1 [1.11.1 201007282301] org.netbeans.modules.profiler.oql.language/0 [0.7.1 201007282301]
Ok, I see. Could you try opening a copy of your project with the latest dev build. It works fine for me so hopefully it will work for you too. Feel free to reopen the issue ff you still experience the problem.
I downloaded latest nightly. Same thing. Both with my project and yours.
Ok, found the difference. I had the jar placed under a project directory and it caused the main class to be resolved. When I put the jar anywhere else I start getting the error you are describing.
I tried to recreate the project. Didn't help. This showed up in the log, not sure whether it will help any. WARNING [org.netbeans.core.startup.InstalledFileLocatorImpl]: no code name base passed when looking up build.properties at org.netbeans.modules.profiler.j2se.J2SEProjectTypeProfiler.getProjectProperties(J2SEProjectTypeProfiler.java:306)
I'd like to use this workaround of yours in the meantime. I tried moving the jar under the source directory (I have a project with existing sources), but it didn't help. Any hints?
Fixed in http://hg.netbeans.org/profiler-main/rev/de3da80c8db8 Profiler now checks for presence of the main class in dependecies as well.
Integrated into 'main-golden', will be available in build *201101290000* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/de3da80c8db8 User: Jaroslav Bachorik <yardus@netbeans.org> Log: #157451: Profiler can not detect main class located in a binary library
still present in build 201102080000
Build 201102080000 Using the provided test application and library: 1. Open the App application 2. Resolve reference problems - point to the downloaded LibApp.jar 3. Set the main class *MANUALY* to libapp.LibApp - IDE doesn't support selecting a main class from library 4. Profile the project - everything works fine