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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:47:33+00:00 2026-05-25T11:47:33+00:00

The Beanshell documentation implies that you can run a script using this format on

  • 0

The Beanshell documentation implies that you can run a script using this format on the command line:

java bsh.Interpreter script.bsh [args]

The only problem with this is that I cannot get it to work. I know how to call other scripts with args from a Beanshell script but I cannot get the initial script to take args. Help?

For example, a beanshell script like this one, wont parse the args:

import java.util.*;
for (int i=0; i < args.length; i++) {
  System.out.println("Arg: " + args[i]);
}

Also, this doesn’t work either:

import bsh.Interpreter;
for( i : bsh.args )
System.out.println( i );
  • 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-25T11:47:34+00:00Added an answer on May 25, 2026 at 11:47 am

    The command-line arguments are available under bsh.args, not args. So if you change all instances of args in your code with bsh.args, you should be good to go. Reference: Special Variables and Values.


    This worked for me:

    for (arg : bsh.args)
        print(arg);
    

    Example:

    $ bsh foo.bsh 1 2 3
    1
    2
    3
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to pass parameter to remote beanshell script which is run through java
i wanted to use my java code as beanshell script but beanshell throws Exception
i want to connect to my database using beanshell script. my code works with
This link says that Android support Python, Lua and BeanShell Scripts, subsequently for Perl
Is there anything like Beanshell, which exposes CLR classes instead of Java classes, and
What is if not equal statement in beanshell ? if this is equal :
Greeting, I'm trying to put some Beanshell script in my Ant build.xml file. I've
Is there a beanshell equivalent of java continue ? ex : if(...cond){ dosomething(); continue;
I'm using Beanshell as an embedded debugging tool in my app. It means I
i wrote java code in beanshell but it throws java.lang.NoClassDefFoundError by defining DefaultHandler. 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.