From: SourceForge.net <no...@so...> - 2010-04-10 21:44:09
|
Bugs item #2985180, was opened at 2010-04-10 16:44 Message generated for change (Tracker Item Submitted) made by mgricken You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=438935&aid=2985180&group_id=44253 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Interactions Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Mathias Ricken (mgricken) Assigned to: Nobody/Anonymous (nobody) Summary: Can't Invoke main Method of Class Declared in Interactions Initial Comment: A main method in a class declared in the Interactions Pane cannot be invoked using the "java Foo" syntax: It can be invoked using a static method call. > class Foo { public static void main(String[] args) { } } > java Foo java.lang.NoSuchMethodError: main at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at edu.rice.cs.dynamicjava.symbol.JavaClass$JavaConstructor.evaluate(JavaClass.java:289) at edu.rice.cs.dynamicjava.interpreter.ExpressionEvaluator.handleConstructor(ExpressionEvaluator.java:128) at edu.rice.cs.dynamicjava.interpreter.ExpressionEvaluator.visit(ExpressionEvaluator.java:98) at koala.dynamicjava.tree.SimpleAllocation.acceptVisitor(SimpleAllocation.java:137) at edu.rice.cs.dynamicjava.interpreter.ExpressionEvaluator.value(ExpressionEvaluator.java:38) > public class Foo2 { public static void main(String[] args) { } } > java Foo2 java.lang.NoSuchMethodError: main at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at edu.rice.cs.dynamicjava.symbol.JavaClass$JavaConstructor.evaluate(JavaClass.java:289) at edu.rice.cs.dynamicjava.interpreter.ExpressionEvaluator.handleConstructor(ExpressionEvaluator.java:128) at edu.rice.cs.dynamicjava.interpreter.ExpressionEvaluator.visit(ExpressionEvaluator.java:98) at koala.dynamicjava.tree.SimpleAllocation.acceptVisitor(SimpleAllocation.java:137) at edu.rice.cs.dynamicjava.interpreter.ExpressionEvaluator.value(ExpressionEvaluator.java:38) > public static class Foo3 { public static void main(String[] args) { } } Modifier static is not allowed here > Foo.class.getDeclaredMethods() { public static void Foo.main(edu.rice.cs.dynamicjava.interpreter.RuntimeBindings,java.lang.String[]) } > Foo2.class.getDeclaredMethods() { public static void Foo2.main(edu.rice.cs.dynamicjava.interpreter.RuntimeBindings,java.lang.String[]) } > Foo.main(new String[]) > ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=438935&aid=2985180&group_id=44253 |