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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:17:29+00:00 2026-05-27T10:17:29+00:00

I am new to jsp and runtime. I need to be able to run

  • 0

I am new to jsp and runtime. I need to be able to run a script with a button on a web application page. The location of the script is in /home/user/ejbca_4/bin and to run it,

cd ejbca_4/bin
./ejbca.sh batch

Someone recommended to put these commands in a .sh file in /home/user/bin . I created /home/user/bin/test.sh with the following contents:

#!/bin/bash
cd ejbca_4/bin
./ejbca.sh batch

I added this to the jsp page

<input type="submit" name="Generate test" value='<c:out value="Generate Test"/>' tabindex="<%=tabindex++%>"
            onClick='generate()'>

function generate() {
  Process proc = Runtime.getRuntime().exec("test.sh",null,null);
}

but somehow this gave a NumberFormatException. I removed Process proc:

function generate() {
  Runtime.getRuntime().exec("test.sh",null,null);
}

and there was no NumberFormatException. However, the the script was not run. Can anyone explain how this should be done?

  • 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-27T10:17:30+00:00Added an answer on May 27, 2026 at 10:17 am

    You need to understand which part of your code is running on the server and which part is running on the client(browser). And you should never put code that should be run on the server into the client side, because that won’t work(obviously).

    In your case, code that should be run on the server is:

    Runtime.getRuntime().exec("test.sh", null, null);
    

    It should be surrounded by <% %>

    And the client side code is:

    <input ... onclick='generate()'>
    <script>
        function generate() {
            // tells the server to do 'Runtime.getRuntime().exec(...)'
        }
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have developed a JSP web application which, on every request, spawns a new
I am new to JSP/Servlets/MVC and am writing a JSP page (using Servlets and
i am new to web programming. i am trying to connect database using jsp
app.yaml application: cloudymovie version: 1 runtime: java welcome_files: - test.jsp handlers: - url: /test/*
I'm trying to submit the page and forward to a new JSP. h:outputlink will
Iam new to JSP and i can't seem to figure out how to run
I have created a new JSP file called loggedOut.jsp and after I click logout
I am new to JSP and generating a form with a text area. Is
i am new in JSP,i have some problem with the following code : <%@
I'm new to JSP and netbeans, I'm trying to make a simple communication between

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.