0
votes

getting the following error while running the XML file on ubuntu terminal i am running the following command

java -cp/home/dev2/eclipse-workspace/seffcon/bin;/home/dev2/eclipse-workspace/seffcon/libs* org.testng.TestNG testng.xml

Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit. bash: /home/dev2/eclipse-workspace/seffcon/libs: Is a directory

1
Just remove the * from /home/dev2/eclipse-workspace/seffcon/libs* - NeplatnyUdaj
not working showing following error Unrecognized option: -cp/home/dev2/eclipse-workspace/seffcon/bin Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit. bash: /home/dev2/eclipse-workspace/seffcon/libs: Is a directory dev2@dev2-ThinkCentre-M72e:~/eclipse-workspace/seffcon$ - maruf sayyed
You also need to use colon instead of semicolon to separate paths. - NeplatnyUdaj
facing the same issue of JVM and unrecognize option - maruf sayyed

1 Answers

0
votes

You are using bash. In the bash shell language, the ; character separates commands. But you appear to be using it as if it was a classpath separator.

On Linux and MacOS and other UNIX-like systems, the classpath separator is : not ;.

The correct command is:

java -cp /home/dev2/eclipse-workspace/seffcon/bin:/home/dev2/eclipse-workspace/seffcon/libs/* org.testng.TestNG testng.xml

Note:

  1. colon not semicolon,
  2. a space after -cp, and
  3. a classpath wildcard (to match one or more JAR files) is only recognized after a file separator.