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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T13:36:09+00:00 2026-05-15T13:36:09+00:00

Im developing a simple console Application using java. The code is given below `

  • 0

Im developing a simple console Application using java. The code is given below

`   try {
            File file = new File("writer.txt");
            writer = new BufferedWriter(new FileWriter(file));
            Process myProcess = Runtime.getRuntime().exec("jps -l");
            BufferedReader stdout = new BufferedReader(new InputStreamReader(
                    myProcess.getInputStream()));
            String line = stdout.readLine();
            while (line != null) {
                if (line.contains(".jar")) {
                    writer.write(line);
                    System.out.println(line);
                }
                line = stdout.readLine();
            }
            writer.close();
           }
`    

The code will display the currently running the jar in my windows. The output format is displayed 2356 Timeout.jar I want to display it only Timeout.jar How to remove that integer values. 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-05-15T13:36:10+00:00Added an answer on May 15, 2026 at 1:36 pm

    Assuming you have “2356 Timeout.jar” in line, this will return just the jar name:

    line.substring(line.indexOf(" ") + 1);
    

    I think there must be an easier way to get the running jar though. I did a quick search and you may want to look at these questions:

    • How to get the path of a running JAR file?
    • http://arstechnica.com/civis/viewtopic.php?f=20&t=261563
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im developing a simple console application using java. I want to display currently running
I am developing a simple pyramid application where I am using JQuery to do
I am developing a simple android application using eclipse. I wrote a JUnit TestCase
I am developing a simple application using the current latest versions of nodejs +
i am developing simple game application just using pan gesture and cgaffinetransform rotate application
I am developing a simple platform game in Java using BlueJ. Over the next
Hey, I've been developing an application in the windows console with Java, and want
I am developing a simple Console Application with MonoDevelop on my Mac. Each time
I'm developing simple C# application using Windows.Forms on .NET. I need some button that
I'm developing simple CUDA app. I followed steps given on http://www.ademiller.com/blogs/tech/2010/10/visual-studio-2010-adding-intellisense-support-for-cuda-c/ but still there

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.