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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T23:53:01+00:00 2026-06-06T23:53:01+00:00

I would like to run in Java with the Runtime’s exec() method a C

  • 0

I would like to run in Java with the Runtime’s exec() method a C program. The Java code is the following:

Runtime runtime = Runtime.getRuntime();
Process process = runtime.exec(command);
process.waitFor();

How can I define in this case the compiled C program’s running time? I mean, if I can set a time interval and if the code hadn’t finished running in that interval, to give back a Time limit exceeded error?

  • 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-06T23:53:02+00:00Added an answer on June 6, 2026 at 11:53 pm

    I think you should better think in terms of multi threaded programming here.
    Once you’ve started to execute the program outside the JVM you can’t really tell from Java ‘stop executing this program’…

    So you should probably run the code you’ve presented here in a separate thread and use

    Object.wait(long milliseconds)

    to wait for the results of this thread.
    if you didn’t get the result proceed your program.

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

Sidebar

Related Questions

I would like execute the following command with Java: C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqldump -u
I would like to run a jar file extracted from my java project to
I have an Java applications which I would like to run with different values
I have a web-application written in java. I would like to run integration tests
I've got some heavyweight process, which does some video processing. I would like run
I would like to run the following SQL select: SELECT ID, NUMERATOR, (SELECT m.COLUMNNAME
Suppose we have the Java code: Object arr = Array.newInstance(Array.class, 5); Would that run?
If I add a shutdown hook to my Java program's runtime like so: public
I would like to determine the jar file name from my java code. I
I am trying to run the following C++ method from Java using JNA, but

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.