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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:47:51+00:00 2026-06-17T17:47:51+00:00

How can i make constructor that can handle IOException this is the class with

  • 0

How can i make constructor that can handle IOException

this is the class with constructor

public class RootProcess {
Process process;

public RootProcess() throws IOException {

}

public RootProcess(Process process){
    this.process = process;
}

public Process getProcess() {
    return process;
}

public void setProcess(Process process) {
    this.process = process;
}


}

And this is how i declare it

RootProcess process = new RootProcess(Runtime.getRuntime().exec("su"));

but i get this error in eclipse

Default constructor cannot handle exception type IOException thrown by implicit super constructor. Must define an explicit constructor
  • 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-17T17:47:53+00:00Added an answer on June 17, 2026 at 5:47 pm

    if you running this from a method either declare the exception in method signature or handle it using try/catch block.

    Declaring the exception:

    public void someMethod() throws IOException {
         RootProcess process = new RootProcess(Runtime.getRuntime().exec("su"));
    }
    

    Handle the Exception:

    public void someMethod() {
    try {
    RootProcess process = new RootProcess(Runtime.getRuntime().exec("su"));
    }
    catch(IOException ex){
    //handle it here
    }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can we make a class copy constructor virtual in C++? How to use?
How can I call a function and keep my constructor private? If I make
In bash how can I make a construction like this to work: if (cp
How can make a link within a facebox window that redirects it to another
I can make a log in for easily, so that's not the problem. What
I can make batch or vbs file on windows and run. this can automate
I have a C++ class that contains a non-copyable handle. The class, however, must
I want to make a constructor function that creates a documentElement object. As an
Using MonoTouch, I'm trying to make a custom view, so I can reuse this
I'm making a handler class that will read similar to this: package avian.background {

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.