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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T18:31:09+00:00 2026-06-06T18:31:09+00:00

I am a total newbie in JSPs/Tomcat and to a large extent in Java

  • 0

I am a total newbie in JSPs/Tomcat and to a large extent in Java as well. Here’s what I have to do — when a user clicks a button/visits a URL, I want to launch a Java program (which takes some command line arguments).

I can very easily do

Runtime.exec("C:\\Python27\\python.exe test.py") 

OR

Runtime.exec("java -cp %CLASSPATH%;C:\\devprojects HelloWorld"

and this works fine. Where HelloWorld.class just prints “HelloWorld”.

However, when I attempt a java program which takes command line arguments, the GET request just hangs doing nothing. I don’t know what logs to look for or what could be wrong here. After having spent TWO days on trying various things, I am just about to give up now.

Runtime.exec("java -cp %CLASSPATH%;C:\\devprojects Run --username Blah --password Foo");

What user does Tomcat end up running this java program as? Can I make it to be Administrator? This is on Windows 2008, does UAC interfere with things?

I cannot modify the Run.class here, I HAVE to run it as is and with command line parameters.

Please advise.

  • 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-06T18:31:10+00:00Added an answer on June 6, 2026 at 6:31 pm

    One idea: you are relying on the default tokenization of your command line as one complete String, and it is not parsing the last one as you expect. Instead you should use the form of this method that takes a String[], after you have chopped up the command line yourself:

    http://docs.oracle.com/javase/6/docs/api/java/lang/Runtime.html#exec(java.lang.String%5B%5D)

    Or, it is waiting for input from you, or waiting for you to read its output. This could explain the hang. Search the internet for the dangers of streams and Runtime.exec().

    Consider ProcessBuilder instead.

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

Sidebar

Related Questions

Total newbie to R here (so far very pleased!). I have a large array(vector?)
Total newbie to XPath and Java here. What I'm attempting to do is something
i'm a total newbie to java and Alfresco and i have this simple problem:
Total newbie question here; I apologize in advance. Suppose I have a daemon written
Total newbie here, regarding sqlite, so don't flame too hard :) I have a
I have a strong python background and a total newbie with Java, so I
I am a total newbie in servers/hosting etc, although I have some experience in
Total newbie question now... Suffice to say, I have searched for a completely noddy
A total newbie question, so please bear with me here ;) When a key
I am a total newbie when it comes to both java and android coding.

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.