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.
Observed in [dev jan 09], but reported for earlier, and probably broken since 3.4. If you try to create a customized JavaProcessExecutor ("External Execution") to execute a special kind of class with a wrapper, the executor prevents you from doing so (for no apparent reason). E.g. to reproduce: In sampledir, create a file Wrapper.java: public class Wrapper { public static void main(String[] args) throws Exception { String clazz = args[0]; Class c = Class.forName(clazz); Runnable r = (Runnable)c.newInstance(); r.run(); r.run(); } } and a file Foo.java: public class Foo implements Runnable { public void run() { System.out.println("Ran Foo..."); } } Compile them. Now create a new External Execution type, called Wrap Exec. Set its External Process: {java.home}{/}bin{/}java Wrapper -cp {filesystems}{:}{classpath} {classname} Set executor for Foo to Wrap Exec. Select Foo, click Execute. You get: Class Foo has no main method. Configure / Cancel and on console: INFORMATIONAL *********** Exception occurred ************ at Fri Jan 10 02:03:03 EST 2003 Annotation: Class Foo has no main method. java.io.IOException at org.netbeans.modules.java.JavaExecSupport.isExecutable(JavaExecSupport.java:106) at org.netbeans.modules.java.JavaProcessExecutor.execute(JavaProcessExecutor.java:103) [....] Whereas it should print to the Output Window: Ran Foo... Ran Foo... This is a regression in JavaProcessExecutor.java: revision 1.3 date: 2002/05/03 12:42:31; author: thurka; state: Exp; lines: +10 -0 bugfix #22813, JavaProcessExecutor and JavaThreadExecutor were modified to check that they can execute selected file Now #22813, as far as I can tell, was referring to JavaThreadExecutor, for which the executor does indeed need to check for a main method - it is going to call it, and this is not configurable. But for JPE, you cannot know what the external process will want to check. In fact running a class with no main method using the Java launcher is harmless; you get a reasonable message: Exception in thread "main" java.lang.NoSuchMethodError: main Doesn't offer to let you configure the executor, it is true, but so what; you can still do that if that is what you actually wanted. Cf. nbusers.
Probable workaround (untried, just off the top of my head): Make sure the directory $userdir/system/Templates/Services/Executor/ exists. Create a file in it, PlainProcessExecutor.settings: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE settings PUBLIC "-//NetBeans//DTD Session settings 1.0//EN" "http://www.netbeans.org/dtds/sessionsettings-1_0.dtd"> <settings version="1.0"> <instanceof class="org.openide.ServiceType"/> <instanceof class="org.openide.execution.Executor"/> <instance class="org.openide.execution.ProcessExecutor"/> </settings> Restart NB. Open Options dialog. Expand Templates -> Services -> Execution Types -> (something), whichever the new one is - you will be able to tell since it will have no {assertEnabled} in the arguments. Click it and set Template to True in the prop sheet. Rename it if necessary to make it distinctive. Now use that as the template for new external execution services; it should not have the undesirable behavior.
You are right. This is regression -> raising priority. I will remove check in JavaProcessExecutor.
Fixed in trunk and release35 branch.
VERIFIED