Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6348587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:27:00+00:00 2026-05-24T21:27:00+00:00

I have a GUI application. In my main class I have a method (called

  • 0

I have a GUI application. In my main class I have a method (called createAndShow()) to initialize all my GUI classes. Inside each GUI class, I have static initializer to read properties files(resource bundles or configuration files). If a file or entry is missing or value is wrong, I catch the exception and then throws a MissingResourceException to upper level on purpose. In my createAndShow() method of the main class, I put a try-catch to catch Exception. But somehow JVM refuse to get there. Whenever a file is missing, that MissingResourceException is thrown and then the application just hang. I expected the createAndShow() method will catch that exception and exit gracefully. Is there anything special for exceptions throws from the static initializer?

I am using XP and java 1.6.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T21:27:01+00:00Added an answer on May 24, 2026 at 9:27 pm

    Static initializers are invoked by the class loader, not by any user code.

    You will not be able to capture those exceptions, and since the classes you need are not able to be loaded, your application will crash.

    My recommendation would be to do a Configuration singleton class. You could use What is an efficient way to implement a singleton pattern in Java?. Create an init() or load() method in that class which will be able to throw the exceptions that can be caught in your createAndShow() method.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WPF application with the main Window class called MainWindow. Since I
My use case is very simple : I have a GUI application, and inside
I have a Main method that creates a message loop called SysTrayApp: void Main()
I have a main application class, which contains a logger, plus some general app
I have a Class MyClass, that when it runs it initialize a GUI awt
I have a class library that is nested two+ layers under a main GUI
I have complex GUI application written in Python and wxPython. I want it to
I have a Windows GUI application that's using the Qt framework (currently version 3.3.5,
I have a GUI C++ application (Visual Studio 2008) that needs to be converted
Suppose I have a GUI-only application that runs on Windows and I'd like to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.