# Command line parameters usage

**URL:** <https://community.gatling.io/t/command-line-parameters-usage/848>\
**Category:** Gatling (Open-Source)\
**Created:** [March 4, 2014, 6:59pm UTC](https://community.gatling.io/t/command-line-parameters-usage/848 "2014-03-04T18:59:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sajjad\_Lateef](https://avatars.discourse-cdn.com/v4/letter/s/3da27b/32.png) [@Sajjad\_Lateef](https://community.gatling.io/u/Sajjad_Lateef)\
**Post date:** [March 4, 2014, 6:59pm UTC](https://community.gatling.io/t/command-line-parameters-usage/848/1 "2014-03-04T18:59:23Z")

</div>

Gatling 2.0.0M3a

Objective to use command line parameters to specify users, ramp up time and duration of simulation.

Question: I got the code to compile as below, but, was wondering if there is a better way.

e.g. gatling.sh -s basic.mysimulation -Dusers=100 -Drampup=100 -Dsimulation\_duration=3600

And the simulation would run with 100 users, coming in over 100 seconds (1 user per second)  
and run the main simulation for 1 hour.

In my simulation, I do the following

40 val number\_of\_users = userNumber(Integer.getInteger(“users”))  
41 val rampup = intToFiniteDuration(Integer.getInteger(“rampup”))  
139 setUp(myScenario.inject(ramp(number\_of\_users) over (rampup))).protocols(httpProtocol)

I cannot use code like:  
ramp(Integer.getInteger(“users”) users) over (Integer.getInteger(“rampup”) seconds)

10:34:06.054 [ERROR] i.g.a.ZincCompiler$ - mySimulation.scala:139: value seconds is not a member of scala.concurrent.duration.FiniteDuration  
10:34:06.056 [ERROR] i.g.a.ZincCompiler$ - setUp(myScenario.inject(ramp(number\_of\_users) over (rampup seconds))).protocols(httpProtocol)

and

10:20:46.582 [ERROR] i.g.a.ZincCompiler$ - /mySimulation.scala:137: value users is not a member of String  
10:20:46.584 [ERROR] i.g.a.ZincCompiler$ - setUp(myScenario.inject(ramp(System.getProperty(“users”) users) over (Integer.getInteger(“rampup”, 100) seconds))).protocols(httpProtocol)

Question2: How can I invoke scala compiler (ZincCompiler) from the command line for a specific scala file, instead of running gatling.sh to compile the changed code?

Thanks  
Sajjad

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [March 4, 2014, 8:12pm UTC](https://community.gatling.io/t/command-line-parameters-usage/848/2 "2014-03-04T20:12:09Z")

</div>

Scala Int and Java Integer are different.  
When you write 2 users, there’s an implicit conversion from Int to SomethingElse that make the users method available.  
The thing is that the Scala compiler can’t trigger 2 implicit conversions at the same time.  
When you write “Integer.getInteger(“users”) users”, you’d indeed need two: one from Integer to Int and the one mentioned above.  
Write Integer.getInteger(“users”).toInt users and you’ll be back to 1 and it will work.

This behavior is the exact reason why we dropped this users “unit” in upcoming 2M4: ramp becomes rampUsers and rampUsersPerSec, so rampUsers(Integer.getInteger(“users”)) will work.

Regarding the second tentative: System.getProperty returns a String, so this will never work.

Get it?

---

<div class="post-metadata">

**Author:** ![Sajjad\_Lateef](https://avatars.discourse-cdn.com/v4/letter/s/3da27b/32.png) [@Sajjad\_Lateef](https://community.gatling.io/u/Sajjad_Lateef)\
**Post date:** [March 4, 2014, 8:22pm UTC](https://community.gatling.io/t/command-line-parameters-usage/848/3 "2014-03-04T20:22:12Z")

</div>

I understand clearly. Thanks!

I keep struggling with implicit type conversions … knowing that two conversions are not allowed answers most of the issues I see.

Question2: How can I invoke scala compiler (ZincCompiler) from the command line for a specific scala file, instead of running gatling.sh to compile the changed code?
