Not all Java classes can be run as an application

jabber (jabber)
If we issue a command like

java Hello

it implies we take it as an Java Application. It should have a main(String args[]) method as
an entry point. The code you mentioned, I guess because I don't have a copy of Thinking in Java, has No main() methods.
So this you cannot run it by issuing a command like

java AllOps

If you do that, JVM will examine the byte-code. Once it goes throught the byte-code and does not foind main() method, it throws the error you cited here.

Jabber bets!

godd luck.

2000-11-3 -04:00

回到话题: Jabber, when I read ThinkingInjava, I run a programme named First, I compiled it successfully, afterwards, I run it, but error "Exception in thread 'main'...". Why?

回到论坛: HOME枫下论坛枫下论坛主坛工作学习IT技术讨论