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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:25:45+00:00 2026-06-17T14:25:45+00:00

I use the following to launch a Java application from another Java app. ProcessBuilder

  • 0

I use the following to launch a Java application from another Java app.

    ProcessBuilder pb = new ProcessBuilder(javaPath + javaCommand, maxMemStr,
            minMemStr, stackSizeStr, jarCommand, jarfile, jarArg);
    try {
        Process p = pb.start();
    } catch (IOException ex) {
        Logger.getLogger(launch.class.getName()).log(Level.SEVERE, null, ex);
    }

where javaCommand is either java or javaw (javaPath is empty most of the time unless a user points to an alternate path). The problem is, after the app launches, even when I verify the process list to contain java, it doesn’t show the console.

Is it because PrcoessBuilder doesn’t invoke the command shell? Is there a way to show the console programatically?

Thanks in advance.

  • 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-17T14:25:47+00:00Added an answer on June 17, 2026 at 2:25 pm

    This is because the “command console” itself is a process that attaches to the std-in/-out/-err streams of another process and displays them on the screen. When you launch Java all by itself, no other processes will be handling those streams, hence the lack of a command console. To get the results you want, you will need to launch a new instance of the command console and subsequently have it run your custom java command.

    There may be a better way to do this… but I think the solution to this is going to be platform-dependent. In Windows, you could do something like:

    ProcessBuilder pb = new ProcessBuilder("start", "\"JAwesomeSauce\"", "cmd.exe",
        "/k", javaPath + javaCommand, maxMemStr, minMemStr, stackSizeStr, jarCommand,
        jarfile, jarArg);
    try {
        Process p = pb.start();
    } catch (IOException ex) {
        Logger.getLogger(launch.class.getName()).log(Level.SEVERE, null, ex);
    }
    

    I assume you could do something similar in Linux/Mac if that’s the O/S you’re using.

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

Sidebar

Related Questions

I use the following command to record audio and video from my webcam gst-launch-0.10
I understand the following is the typical code to launch an exe from java
for example i use following command to find a record SELECT `users`.`mail` FROM `users`
I use VS2010, C# to develop Silverlight 4 app, I use following code in
I'm trying to launch a java application on an ARM platform running Ubuntu 10.04.
I'm trying to use the following code: args = 'LD_LIBRARY_PATH=/opt/java/jre/lib/i386/:/opt/java/jre/lib/amd64/ exec /opt/java/jre/bin/java -Xincgc -Xmx1G
On linux, I often launch and compile from the command line (java/javac) Though, Java
I am trying to use Runtime.exec to run a class file from my java
I know that i can use the following code to launch my own url,
I am trying launch adduser command from perl. use strict; use warnings; my @test=('/usr/sbin/useradd',

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.