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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:31:53+00:00 2026-05-28T19:31:53+00:00

How do you execute a JAR file within your source code? I know that

  • 0

How do you execute a JAR file within your source code?

I know that for an exe, you use

try
{
 Runtime rt = Rintime.getRuntime() ;
 Process p = rt.exec("Program.exe") ;
 InputStream in = p.getInputStream() ;
 OutputStream out = p.getOutputStream ();
 InputSream err = p,getErrorStram() ;

//do whatever you want
 //some more code

 p.destroy() ;
}catch(Exception exc){/*handle exception*/}

Is it the same only:

rt.exec("program.exe") changes to rt.jar("program.jar") or is it something different?

  • 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-05-28T19:31:54+00:00Added an answer on May 28, 2026 at 7:31 pm

    In order to extract a jar file instead of exec(“program.exe”) you need to say

    exec("<path to jar command> -xf program.jar") 
    

    Usually the jar command is available in your bin directory and if the env variables are properly set , you can even say
    exec(“jar -xf program.jar”)

    For running the jar file you can say “java -jar program.jar”

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

Sidebar

Related Questions

I have a jar file that I would like to execute using PHP, but
I have generated .jar file in windows. I have to execute that .jar file
I execute the ftp.exe cmd through a C# System.Diagnostics.Process type. And I use the
Is it possible to execute a JAR file on any OS (like Windows, Linux,
I've got a executable JAR file. And I've got an Ant build script that
I have made a .jar file that joins two wave files together.I call it
I have a shell script that calls a java jar file and runs an
I wrote a program that runs fine, however packaging the file into a jar
I wrote an application with java and convert it to execute jar file, my
I have a working exec in php that executes a Jar file and returns

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.