You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Pascal Schumacher (JIRA)" <ji...@apache.org> on 2015/07/08 18:09:04 UTC

[jira] [Resolved] (GROOVY-3233) The main(args) entry point cannot be found when a class file has multiple classes and the first class extends another class.

     [ https://issues.apache.org/jira/browse/GROOVY-3233?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pascal Schumacher resolved GROOVY-3233.
---------------------------------------
       Resolution: Fixed
    Fix Version/s: 2.5.0-beta-1

The example works for me with current master, so I'm resolving this.

> The main(args) entry point cannot be found when a class file has multiple classes and the first class extends another class.
> ----------------------------------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-3233
>                 URL: https://issues.apache.org/jira/browse/GROOVY-3233
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler
>    Affects Versions: 1.6-rc-1
>         Environment: Groovy Version: 1.6-RC-1 JVM: 1.6.0_11.   WinXP
>            Reporter: josef betancourt
>             Fix For: 2.5.0-beta-1
>
>
> Running the classes shown below results in:
>             groovy -cp ..\main\groovy ..\main\groovy\MainInvokeSub.groovy
>             Caught: groovy.lang.GroovyRuntimeException: This script or class could not be run.
>             It should either:
>             - have a main method,
>             - be a JUnit test, TestNG test or extend GroovyTestCase,
>             - or implement the Runnable interface.
> However, if the 'extends MainInvokeBase' is removed or if the second class is commented out, it does run.
> The only "spec" I could find about the expected behavior is in the GINA book.
> file:  MainInvokeBase.groovy
>               class MainInvokeBase { 
>               }
> file: MainInvokeSub.groovy
>         class MainInvokeSub extends MainInvokeBase{    
>                      static main(args){  println "Hello world!"    }      
>         }
>         def class SecondClass{    
>         }



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)