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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:05:06+00:00 2026-06-10T12:05:06+00:00

Is there an appropriate exception class for invalid command line arguments in the Java

  • 0

Is there an appropriate exception class for invalid command line arguments in the Java API or do I have to create my own? I’ve tried searching for one but can’t find any in the API.

This is for an assignment so I cannot use third party libraries for command line parsing.

  • 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-10T12:05:07+00:00Added an answer on June 10, 2026 at 12:05 pm

    The best way to handle unknown command line parameters or combinations that don’t make sense to the program is to display an error message and offer a usages output.

    Personally, depending on the complexity of the command line, I will create a method called “usage” (usually static) that can have an optional error message passed to it.

    While parsing the command line parameters passed into the program, I will call this method and either exit, via a flag or directly, or have usage method call exit for me.

    But that’s just me

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

Sidebar

Related Questions

I am wondering whether I am overusing java reflection. I have a class which
I often want to define new 'Exception' classes, but need to have an appropriate
What is the appropriate function that shows how many are there in an array?
I call this a flash meeting, but maybe there is another more appropriate name.
Is it advisable for my own DAO class to throw a SecurityException in its
I have a jar file I produced from compiled class files using an ant
Ok I have a generic interface public IConfigurationValidator<T> { void Validate(); } a class
I have a generic method in a base class similar to the following: protected
I have a class like this public class Obj : IEntity { public virtual
Is there a way to set the default DateFormat class used for parsing strings

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.