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 139404 - must have Sources in order to run main class from a library
Summary: must have Sources in order to run main class from a library
Status: VERIFIED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Source (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Jan Lahoda
URL:
Keywords:
: 144231 (view as bug list)
Depends on: 138504
Blocks:
  Show dependency tree
 
Reported: 2008-07-09 14:45 UTC by shche123
Modified: 2008-10-02 16:49 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 shche123 2008-07-09 14:45:56 UTC
Unable to run a main class from of the jar files in a Library added to the project with F6 without having a Sources
packages associated with the project.

This worked fine in NB 6.1 before I have downloaded the latest set of patches a few days ago...

By adding an empty src folder back to Sources, F6 works fine.

Getting:
NullPointerException at org.netbeans.modules.java.source.classpath.CacheClassPath.<init>
Comment 1 Petr Dvorak 2008-07-11 15:34:33 UTC
I am rising the priority for this issue (I can only guess it is a result of the new CompileOnSave function??), as it is
quite important for me...

It is not possible to run a main class from the jar file now. This effectively prevents users to develop applications
using some middleware framework. For example I am now unable to use JADE (Java Agent DEvelopment) Framework.

Note: I have written an article in Czech language about "How to make JADE running under NB 6.1", and now it does not
work... annoying... If you understand Czech, you can use it to reproduce the issue:
http://joshis.iprofil.cz/clanek-14-navod-jak-rozchodit-platformu-jade-v-netbeans-6.1
http://jade.tilab.com/
Comment 2 Jan Lahoda 2008-07-14 08:23:03 UTC
I guess two different problems are described here:
-the original problem seems like issue #136970, although it is difficult to be sure without the stack trace
-the joshis' problem seems like issue #139630

*** This issue has been marked as a duplicate of 139630 ***
Comment 3 Petr Dvorak 2008-08-13 17:16:54 UTC
Product Version: NetBeans IDE Dev (Build 080813)
Java: 1.5.0_15; Java HotSpot(TM) 64-Bit Server VM 1.5.0_15-b04
System: Linux version 2.6.24-19-generic running on amd64; UTF-8; en_US (nb)
Userdir: /home/joshis/Documents/NetBeansSources/main/nbbuild/testuserdir

I am reopening this issue. It is still not possible to run a main class that is contained in a JAR file that is added to
the libraries. This can make IDE fully useless for development of certain (not a rare one) types of middleware.
Comment 4 Jiri Prox 2008-08-14 16:03:53 UTC
The problem is that the main class which is located in jar on classpath isn't listed when selecting main class

But there are two very simply workarounds
1) create new main class calling  the original main method
or
2) enter the name of main class manually in the configuration

Comment 5 Petr Dvorak 2008-08-14 20:26:37 UTC
Workaround 1) is probably possible but it is not acceptable as this is not the way you use the middleware (manual to
similar middleware solution does not mention this workaround step).

2) - yes, you are right, I know that it is not listed, but this is another issue, it is not the problem I mention here.
Even if you manually type it int the configuration, it does not work (I have sent a project to jlahoda).

I would still suggest P2 priority... Someone who meets this issue will not submit it, he/she would just say the NB is
not mature enough to handle this case...
Comment 6 Petr Dvorak 2008-08-14 20:30:25 UTC
Another note: it works correctly when you disable COS... just tested... so maybe a P3, but a bad one...
Comment 7 Jan Lahoda 2008-08-23 11:46:41 UTC
*** Issue 144231 has been marked as a duplicate of this issue. ***
Comment 8 Jan Lahoda 2008-09-30 13:14:46 UTC
Running a main class from a jar file should work now for CoS (in the same way as it works for the ant build):
http://hg.netbeans.org/main/rev/3ca62d75a91b
Comment 9 Petr Dvorak 2008-10-02 16:49:12 UTC
It is working as expected in:

Product Version: NetBeans IDE Dev (Build 200810011401)
Java: 1.6.0_10-rc; Java HotSpot(TM) Client VM 11.0-b13
System: Linux version 2.6.24-19-generic running on i386; UTF-8; en_US (nb)

Thank you, Honza...