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 7405393
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:23:51+00:00 2026-05-29T05:23:51+00:00

At startup, I want my Java program to load a DLL that should be

  • 0

At startup, I want my Java program to load a DLL that should be on the path defined by java.library.path. However, if that DLL is missing, I want my program to fall back to loading a different DLL. System.LoadLibrary throws an UnsatisfiedLinkError if it can’t find the DLL file. UnsatisfiedLinkError is a subclass of Error, not of Exception. Lots of commentary suggests that it is bad practice to catch Error. Is this a case where it is okay to do something like this?

try
{
    System.loadLibrary("myLibrary");
}
catch (UnsatisfiedLinkError e)
{
    try
    {
        System.load(<a fully qualified path to my fall-back library>);
    }
    catch (UnsatisfiedLinkError e)
    {
        <report that even the fall-back library didn't load>;
    }
}
  • 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-29T05:23:52+00:00Added an answer on May 29, 2026 at 5:23 am

    In this case it’s perfectly acceptable. In fact it’s the only way to do what you want to do.

    In general it’s bad practice to catch Errors because there is nothing you can do to recover from them and the application may be in an unpredictable state afterwards. For example OutOfMemoryError means you have run out of memory and there’s very little you can do about it. StackOverflowError means that your call stack has grown too deep and there’s not a lot you can do about that either.

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

Sidebar

Related Questions

I made a SmartDevice application that runs on startup and I want it to
I want to know the application startup path for C# 2.0 windows form application.
I want to have a javascript overlay box load on startup inviting users to
I want to declare an object in java that is like a a pointer
I have a java servlet with the OData4j library and I want to configure
Hi all i want to run a java application as backend process.that is like
I want design my startup screen with progress bar. But I don't how to
I want a single startup view with a button and a welcome screen. When
I'm using hibernate 3 and want to stop it from dumping all the startup
I have a bunch of properties (configurations) that can change per environment. However these

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.