Return-Path: Delivered-To: apmail-jakarta-jmeter-user-archive@www.apache.org Received: (qmail 30367 invoked from network); 5 Feb 2005 23:18:07 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 5 Feb 2005 23:18:07 -0000 Received: (qmail 68614 invoked by uid 500); 5 Feb 2005 23:18:06 -0000 Delivered-To: apmail-jakarta-jmeter-user-archive@jakarta.apache.org Received: (qmail 68590 invoked by uid 500); 5 Feb 2005 23:18:05 -0000 Mailing-List: contact jmeter-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "JMeter Users List" Reply-To: "JMeter Users List" Delivered-To: mailing list jmeter-user@jakarta.apache.org Received: (qmail 68577 invoked by uid 99); 5 Feb 2005 23:18:05 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=RCVD_BY_IP,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: domain of sebbaz@gmail.com designates 216.239.56.242 as permitted sender) Received: from mproxy.gmail.com (HELO mproxy.gmail.com) (216.239.56.242) by apache.org (qpsmtpd/0.28) with ESMTP; Sat, 05 Feb 2005 15:18:04 -0800 Received: by mproxy.gmail.com with SMTP id q44so86649cwc for ; Sat, 05 Feb 2005 15:18:03 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=piPVw0XY388N4UGpqXgr/gynyOvKoiQSmzYYc1IygEKaZoX9ZvFpNMDBUwaygMscPzE4P/BVFY/sMbzM2B/jaSTPAmSYxPjHT+NC7C2IBEBer2aKs4sELzYdHgYJQg2+7e1VlPZcH42CAklZbZIYkoeZs7pkHLdxcZdjWx3gg7I= Received: by 10.11.116.24 with SMTP id o24mr164707cwc; Sat, 05 Feb 2005 15:18:02 -0800 (PST) Received: by 10.11.118.30 with HTTP; Sat, 5 Feb 2005 15:18:02 -0800 (PST) Message-ID: <25aac9fc05020515184ee6c89@mail.gmail.com> Date: Sat, 5 Feb 2005 23:18:02 +0000 From: sebb Reply-To: sebb To: JMeter Users List Subject: Re: Can variables be declared in BeanShell function? In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N On Fri, 4 Feb 2005 18:09:52 -0500, Kyle McAbee wrote: > Dear JMeter Users: > > Does anyone know whether BeanShell (current bsh-2.0b2.jar file) hosted by JMeter 2.0.2 will allow a script to declare variables? The following BeanShell function fails. What do you mean by "fails"? Are there any error messages in jmeter.log or the console? I think BeanShell allows variables to be used without predeclaring them - have you tried that? By the way, the toString() method call is redundant - str1 is already a string. > > ${__BeanShell(String str1; String str2; str1 = "abc"; str2 = "def"; str1 = str1 + str2; return str1.toString(); ) } > > The same code put in a function in NetBeans 3.6 succeeds: > > private static String showConcatenation () { > > String str1; > String str2; > > str1 = "abc"; > str2 = "def"; > str1 = str1 + str2; > > return str1.toString(); > } > > public static void main(String[] args) { > System.out.println(KillMeNow.showConcatenation()); > } > > Sincerely yours, > > Kyle > > --------------------------------------------------------------------- To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: jmeter-user-help@jakarta.apache.org