Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
496 views
in Technique[技术] by (71.8m points)

macos - Bash file is running fine in windows for testng but it is not working in linux/mac

My bash file is running fine in windows but it is not working in linux/mac. I have created a selenium project with testng and I want to create a bash file so I can run my project without IDE

I have searched but till not getting any solution for same

Error on terminal:-

>bash TestNg_RunMe.bat 
>Error: Could not find or load main class ..src.lib.selenium-java-2.46.0.jar
>TestNg_RunMe.bat: line 1: ./bin: Is a directory

Note:- I have use bash command also to run the command in linux and mac

Also lib and bin directory is present in right place(As it working fine in windows)

My bash file is :-

java -cp ./src/lib/*;./bin org.testng.TestNG testng.xml

Above bash is working perfect for windows I have also tried with full absolute path I have also extract testng.jar and add it in bash file but nothing work.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Paths are separated using : under Unix-like systems and not ; as in Windows:

java -cp ./src/lib/*:./bin org.testng.TestNG testng.xml

If you are using bash under Windows then changing to : should work everywhere.

The ; character means end of statement to a Unix shell, so what you are attempting to exceute is:

java -cp ./src/lib/*
./bin org.testng.TestNG testng.xml

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...