问题描述
我的bash文件运行良好的窗口,但它不是在Linux / MAC工作。
我已创建了TestNG的硒项目,我想创建一个bash文件,这样我就可以不用IDE中运行我的项目
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
在终端错误: -
>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
请注意: - 我有使用庆典命令也到Linux和Mac运行命令
Note:- I have use bash command also to run the command in linux and mac
此外lib和bin目录在正确的地方present(与在Windows工作正常)
Also lib and bin directory is present in right place(As it working fine in windows)
我的bash的文件是: -
My bash file is :-
java -cp ./src/lib/*;./bin org.testng.TestNG testng.xml
以上的bash是针对Windows的工作完美
我也曾尝试以饱满的绝对路径
我也提取testng.jar并在bash文件添加
但没有工作。
Above bash is working perfect for windowsI have also tried with full absolute path I have also extract testng.jar and add it in bash filebut nothing work.
推荐答案
路径使用分隔:
下的类Unix系统,而不是;
在Windows:
Paths are separated using :
under Unix-like systems and not ;
as in Windows:
java -cp ./src/lib/*:./bin org.testng.TestNG testng.xml
如果您使用的是庆典
在Windows然后更改为:
应该工作到处
If you are using bash
under Windows then changing to :
should work everywhere.
的;
字符的装置的语句的一个Unix外壳结束,所以你正试图exceute是:
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
这篇关于Bash的文件运行良好在TestNG的窗户,但它不是在Linux / MAC工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!