I have a java project that I launch using a bash file :
#!/usr/bin/env bash
java -classpath logger/bin:banking/bin:testframework/bin test.RunTest
I launch my bash in my terminal (in ubuntu) :
firefrost@firefrost-PC:~/ProjetPOO3A$ bash test.sh banking.Account
In my main, I try to get arguments as :
public class RunTest {
public static void main(String[] args) {
System.out.println(args.length);
for(int i = 0; i < args.length; i++)
{
...
The problem is that args.length is 0 when it should be 1 because I passed the argument "banking.Account" in my console.
If I put the argument in the bash file :
#!/usr/bin/env bash
java -classpath logger/bin:banking/bin:testframework/bin test.RunTest banking.Account
my main recognize the argument and the System.out.println outputs 1.
Why is the argument in the console not taken into account?