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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T21:28:55+00:00 2026-06-08T21:28:55+00:00

Something weird has happened. I’ve written a Java program, where I’ve done nothing to

  • 0

Something weird has happened. I’ve written a Java program, where I’ve done nothing to handle uncaught exceptions in any special way. But when I run this one particular program in Windows 7, there is this uncaught exception in a static context called from main that causes a window to pop up, displaying the exception. I have tried to write a small program to duplicate this effect to no avail. One program (which I have written entirely by hand) produces a popup, while no others will do the same.

I’d like to track this down particularly so that I can add code that makes other CAUGHT exceptions display the stack trace in a similar way.

I’ve asked about this in IRC, but people tell me that this doesn’t happen. Well, it DID happen. There is a screenshot below.

I think my only hope is if someone else recognizes this and can tell me where it comes from.

Thanks!

Java exception

UPDATE: Sorry for the delay getting some code. I had to attend to a colicky infant. Please note that this is a desktop Java app. It’s not an applet, and it doesn’t use webstart.

Here is code copied and pasted from the program that gets the dialog. I’ll do another edit to let you know whether or not my colleague (who gets the exception) gets the dialog for this case. I’ve been careful to include everything leading up to the exception. Only the IPAddress class implementation is missing, but that doesn’t participate in the exception, because it’s not actually used until after the exception occurs. Note the asterisks before the line where the exception occurs. That line of code corresponds with the exception you can see in the screenshot.

package staticexception;

import java.net.InterfaceAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.List;
import javax.swing.UIManager;

public class StaticException {
    // Don't need this fully implemented.
    public static class IPAddress {

        public static IPAddress getBroadcast(IPAddress mask, IPAddress myip) {
            return new IPAddress();
        }

        public IPAddress() {}

        public IPAddress(int maskval) {}

        public IPAddress(byte[] addr) {}

        public IPAddress mask(IPAddress netmask) {
            return this;
        }

        public int prefixLength() {
            return 0;
        }

    }

    public static class Network {
        public IPAddress broadcast, netmask, ip;
        boolean remember;

        public Network(IPAddress br, IPAddress nm, IPAddress ip) {
            broadcast = br;
            netmask = nm;
            this.ip = ip;
        }

        boolean match(IPAddress ip) {
            IPAddress a = ip.mask(netmask);
            IPAddress b = this.ip.mask(netmask);
            return (a.equals(b));
        }

        @Override
        public String toString() {
            return ip.toString() + "/" + netmask.prefixLength();
        }
    }

    static List<Network> my_networks;

    static void enumerateNetworks() {
        my_networks = new ArrayList<Network>();

        Enumeration<NetworkInterface> nets = null;
        try {
            nets = NetworkInterface.getNetworkInterfaces();
        } catch (SocketException ex) {
            ex.printStackTrace();
        }
        for (NetworkInterface netint : Collections.list(nets)) {
            for (InterfaceAddress address : netint.getInterfaceAddresses()) {
                // *** Exception would occur on the next line when 
                // *** address.getAddress() would return null
                byte[] addr = address.getAddress().getAddress();
                if (addr.length == 4 && addr[0] != 127) {
                    int prefixlen = address.getNetworkPrefixLength();
                    int maskval = -1 << (32 - prefixlen);
                    IPAddress mask = new IPAddress(maskval);
                    //my_netmask = mask;
                    System.out.println("Netmask   = " + mask);

                    IPAddress myip = new IPAddress(addr);
                    //my_ip_address = myip;
                    System.out.println("Local IP  = " + myip);

                    IPAddress broadcast = IPAddress.getBroadcast(mask, myip);
                    System.out.println("Broadcast = " + broadcast);

                    my_networks.add(new Network(broadcast, mask, myip));

                    System.out.print(address.getAddress().getAddress().length + " ");
                    System.out.print(address.getAddress() + " ");
                    System.out.print(address.getAddress().getHostAddress() + " ");
                    System.out.println(address.getNetworkPrefixLength());
                }
            }
        }
    }

    static private void setupNetwork() {
        System.setProperty("java.net.preferIPv4Stack","true");

        enumerateNetworks();

        // ... stuff that would happen after the exception
    }

    public static void main(String[] args) {
        try {         
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());     
        } catch (Exception e) {}

        setupNetwork();

        // ... stuff that would happen after the exception
    }
}

SECOND UPDATE: My colleague reports that this program does NOT produce the dialog. The only difference between this and the program that gets the pop-up is that the program that gets the pop-up is being launched from an exe wrapper produced by AdvancedInstaller. Besides that, within the Java program, the sequence of execution is identical. I’ve googled this, and as far as I can find, AdvancedInstaller does nothing at all that would result in this pop-up being generated. I’m not sure that it CAN without modifying the Java program (which it doesn’t), because I’m not sure that you can do anything from outside the Java program to make this happen. Except perhaps capture stderr, but that doesn’t explain why other programs wrapped by AdvancedInstaller don’t produce this pop-up or why later exceptions produced by this application also do not produce this pop-up.

  • 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-06-08T21:28:57+00:00Added an answer on June 8, 2026 at 9:28 pm

    2nd Answer (After additional information added to question)

    Advanced Installer has a "Startup failure check" setting described as follows:

    Startup failure check

    Any uncaught exception from the main thread is
    described in a dialog box that will allow the user either to stop the
    application or to ignore the exception. This option applies only to
    GUI applications.

    More info: http://www.advancedinstaller.com/user-guide/java-product-settings.html .

    1st Answer

    This is highly dependent on context and you have not provided enough information to get a very specific answer. The loc2.LoC2.java is likely custom or project specific code.

    Generally though, the uncaught handler can be managed (or queried) via:

    • Thread.setDefaultUncaughtExceptionHandler and
    • Thread.getDefaultUncaughtExceptionHandler

    More info:

    • http://docs.oracle.com/javase/6/docs/api/java/lang/Thread.UncaughtExceptionHandler.html
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Something really weird has happened to my source code. The application always built successfully,
Lately something weird has been happening to my projects in xcode: I've been trying
I'm trying to do something weird, I'm trying to determine how many methods has
This is the most weird thing that has ever happened to me when programming
Something weird is happening, I made an EJB3 wich is suposed to write something
Something weird's happening with my Rails app. When I try to send an update
I have something weird going on here. I just finished a site for a
edit This question is solved! Having something weird. I'm using html { font-size: 100%
I'm developing an app using threading, and something weird is happening. I have these
I have just found something very weird while developing a website. While trying 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.