Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #34627

Re: Could not find or load main class com.mindprod.ensure.Ensure

From Eric Sosman <esosman@comcast-dot-net.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: Could not find or load main class com.mindprod.ensure.Ensure
Date 2016-06-13 22:58 -0400
Organization A noiseless patient Spider
Message-ID <njnrth$606$1@dont-email.me> (permalink)
References <caetlb5907fjjg68j34i1cp3pgle3dibjm@4ax.com> <64htlb5ikduodj9qr700ob3tqbulribl5a@4ax.com> <58be2264-bf4a-4da1-a6b2-8501e9daf435@googlegroups.com> <njnkkt$jeh$1@dont-email.me> <njnoa4$17j3$1@gioia.aioe.org>

Show all headers | View raw


On 6/13/2016 9:57 PM, Arne Vajhøj wrote:
> On 6/13/2016 8:54 PM, Eric Sosman wrote:
>> On 6/13/2016 4:48 PM, Lew wrote:
>>> Throwing an exception from 'main' is an antipattern.
>>
>>     Citation?
>
> I have never seen it catalogued as an anti-pattern.
>
> And it is very common in various demos and adhoc programs.
>
> But for a more serious program I would call it very bad for
> a GUI program and a code smell warranting further investigation
> of UX and exception handling for a console program.

     What should the main() of a GUI application do if something
further down the line throws HeadlessException?

     Okay, that's a RuntimeException and perhaps we could fix the
wording to prohibit only the checked exceptions.  But even so: If
main() catches an InterruptedException from something further down,
what action can main() take that would be better than just letting
the IE propagate outward?

	public static void main(String[] args) {
	    try {
	        // "payload" of main()
	    } catch (InterruptedException ex) {
	        LOGGER.severe("I was interrupted!", ex);
	        Thread.currentThread().interrupt();
	        // now what?
	    } catch (Exception ex) {
	        LOGGER.severe("I'm thrown for a loss!", ex);
	        // now what?
	    }
	}

What "constructive" or "useful" steps could be taken in the catch
blocks that would be "better" than letting main() throw the Exception?
In situations where there *is* something better, well sure: Do the
better thing.  But is it a given that something better is possible?

-- 
esosman@comcast-dot-net.invalid
"Don't be afraid of work. Make work afraid of you." -- TLM

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Could not find or load main class com.mindprod.ensure.Ensure Roedy Green <inquiry@mindprod.com> - 2016-06-13 06:51 -0700
  Re: Could not find or load main class com.mindprod.ensure.Ensure Roedy Green <inquiry@mindprod.com> - 2016-06-13 07:02 -0700
    Re: Could not find or load main class com.mindprod.ensure.Ensure Eric Douglas <e.d.programmer@gmail.com> - 2016-06-13 07:15 -0700
  Re: Could not find or load main class com.mindprod.ensure.Ensure Roedy Green <inquiry@mindprod.com> - 2016-06-13 07:35 -0700
    Re: Could not find or load main class com.mindprod.ensure.Ensure Lew <lewbloch@gmail.com> - 2016-06-13 13:48 -0700
      Re: Could not find or load main class com.mindprod.ensure.Ensure Roedy Green <inquiry@mindprod.com> - 2016-06-13 14:11 -0700
      Re: Could not find or load main class com.mindprod.ensure.Ensure Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-06-13 20:54 -0400
        Re: Could not find or load main class com.mindprod.ensure.Ensure Arne Vajhøj <arne@vajhoej.dk> - 2016-06-13 21:57 -0400
          Re: Could not find or load main class com.mindprod.ensure.Ensure Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-06-13 22:58 -0400
            Re: Could not find or load main class com.mindprod.ensure.Ensure Martin Gregorie <martin@address-in-sig.invalid> - 2016-06-14 10:33 +0000
              Re: Could not find or load main class com.mindprod.ensure.Ensure Eric Douglas <e.d.programmer@gmail.com> - 2016-06-14 04:59 -0700
                Re: Could not find or load main class com.mindprod.ensure.Ensure Martin Gregorie <martin@address-in-sig.invalid> - 2016-06-14 15:11 +0000
                Re: Could not find or load main class com.mindprod.ensure.Ensure Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-06-14 11:31 -0400
                Re: Could not find or load main class com.mindprod.ensure.Ensure Eric Douglas <e.d.programmer@gmail.com> - 2016-06-14 09:00 -0700
                Re: Could not find or load main class com.mindprod.ensure.Ensure Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-06-14 13:18 -0400
                Re: Could not find or load main class com.mindprod.ensure.Ensure Eric Douglas <e.d.programmer@gmail.com> - 2016-06-14 10:38 -0700
                Re: Could not find or load main class com.mindprod.ensure.Ensure Lew <lewbloch@gmail.com> - 2016-06-14 12:55 -0700
                Re: Could not find or load main class com.mindprod.ensure.Ensure Eric Douglas <e.d.programmer@gmail.com> - 2016-06-14 13:14 -0700
                Re: Could not find or load main class com.mindprod.ensure.Ensure Lew <lewbloch@gmail.com> - 2016-06-14 13:34 -0700
                Re: Could not find or load main class com.mindprod.ensure.Ensure Eric Douglas <e.d.programmer@gmail.com> - 2016-06-14 13:58 -0700
          Re: Could not find or load main class com.mindprod.ensure.Ensure Lew <lewbloch@gmail.com> - 2016-06-14 12:52 -0700
            Re: Could not find or load main class com.mindprod.ensure.Ensure Stanimir Stamenkov <s7an10@netscape.net> - 2016-06-15 02:46 +0300
              Re: Could not find or load main class com.mindprod.ensure.Ensure Lew <lewbloch@gmail.com> - 2016-06-15 12:22 -0700
              Re: Could not find or load main class com.mindprod.ensure.Ensure Martin Gregorie <martin@address-in-sig.invalid> - 2016-06-16 01:17 +0000
                Re: Could not find or load main class com.mindprod.ensure.Ensure Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-06-15 21:56 -0400
                Re: Could not find or load main class com.mindprod.ensure.Ensure Martin Gregorie <martin@address-in-sig.invalid> - 2016-06-16 11:01 +0000

csiph-web