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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T08:28:07+00:00 2026-05-30T08:28:07+00:00

Is Runtime.getRuntime().exec(cmd /c); platform independent or I have to pass platform specific command in

  • 0

Is

Runtime.getRuntime().exec("cmd /c");

platform independent or I have to pass platform specific command in the parameter?

Thanks


What is the linux equivalent of the command cmd /c start /b java -jar

  • 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-30T08:28:08+00:00Added an answer on May 30, 2026 at 8:28 am

    Runtime.getRuntime().exec() is platform independant in the way, that it will start an external executable on every platform. The executable itself has to be there of course, so starting notepad.exe on Linux will very likely not work (except when you have Wine and Notepad installed, but this is another story).

    On Windows, enter anything you would enter into cmd.exe (details follow). But to do the automatic path lookup on Windows, you need to do something like

    Runtime.getRuntime().exec("start iexplore.exe");
    

    or

    Runtime.getRuntime().exec("start my.pdf");
    

    which opens the pdf file with the associated viewer.

    On linux, you can do anything you would do in a shell like Bash, but you cannot use bash builtins like the pipe operator. You can just start programs and pass arguments.

    To start another Java instance on linux you could use:

    Runtime.getRuntime().exec(new String[] {"java","-jar","myjar.jar"});
    

    Use the absolute path to the java executable if it is not on the PATH.

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

Sidebar

Related Questions

I am running into this problem. my program invokes Runtime.getRuntime().exec(cmd); on a windows platform.
Is it possible to use Runtime.getRuntime().exec(cmd.exe); in gwt? When I compile it, I get
I have the next code: Process p = Runtime.getRuntime().exec(args); and I want my program
I use Java Runtime.getRuntime().exec(command) to create a subprocess and print its pid as follows:
I am connecting to /bin/bash in ubuntu using: process = Runtime.getRuntime().exec(cmd); Here cmd is
I executed a batch file from within my Java code like below: Runtime.getRuntime().exec(cmd /c
I had some code that ran commands through Runtime.getRuntime.exec(String) , and it worked on
I am using Runtime.getRuntime().exec(test.class) to create a process and launch a test.class file. test.class:
I am trying to run this line of code: Process p = Runtime.getRuntime().exec(new String[]
How can I send and receive multiple inputs using Runtime.getRunTime.exec(). For example if I

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.