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

  • Home
  • SEARCH
  • 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 8264067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T04:19:35+00:00 2026-06-08T04:19:35+00:00

I am using install4j to install an intranet application which requires an HTTP and

  • 0

I am using install4j to install an intranet application which requires an HTTP and HTTPS port. I would like to test that these ports are available and warn the user/block the installation until they select unavailable ports.

The only avenue I see for this (besides custom code) is to ensure the windows service fails if the application cannot bind to needed ports, and use a Failure Strategy “Ask user whether to retry or quit on failure”. In the web server startup code, I use System.exit(1) if the server cannot bind to ports. However, this does not appear to register as a failure to the installer – the installation proceeds without invoking the failure strategy.

What is the proper approach for signaling failure to the “Start a service” action? Have other people taken an alternate approach to guaranteeing the installation uses available ports?

  • 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-08T04:19:37+00:00Added an answer on June 8, 2026 at 4:19 am

    A good alternate approach I’ve since found: add a custom code action:

    List<Integer> takenPorts = new ArrayList<Integer>();
    for (int port : Arrays.asList(80, 443)) {
        java.net.ServerSocket socket = null;
        try {
            socket = new java.net.ServerSocket(port);
        } catch (IOException e) {
            takenPorts.add(port);
        } finally { 
            if (socket != null) socket.close(); 
        }
    }
    
    if (takenPorts.isEmpty()) {
         return true;
    }
    else {
        String msg;
        if (takenPorts.size() == 2) {
            msg = "Ports 80 and 443 must be available for uDiscovery";
        }
        else {
            msg = "Port " + takenPorts.get(0) + " must be available for uDiscovery";
        }
        context.setVariable("portErrorMessage", msg);
        return false;
    }
    

    Good explanation of how to wire this up here

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

Sidebar

Related Questions

I'm trying to build a Windows installer using Nullsoft Install System that requires installation
I am using the WiX installer to install an application, and I need to
I installed fxruby using $sudo port install rb-fxruby As suggested in the book. It
I deployed a windows application in the following website http://StagingServer/MyProgs/MPP/ on my intranet site,
I've got a WCF intranet application I'm working on that will have 150 clients
I'm using Install4J to build an installation for my application (lets call it MainApp),
We have written Web application using ASP.NET MVC, which will be hosted in our
I would like to build a winform business solution using SiganlR, but I am
I am trying to install the yi editor using cabal-install, which in turns installs
We need to create an installer for our application. Currently we are using Install

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.