Skip to content

Commit e99d571

Browse files
doublemarketdiemol
authored andcommitted
Provide classpath instead of jar when invoking java (#933)
* Provide classpath instead of jar * Update README about JAVA_CLASSPATH
1 parent 85ebe07 commit e99d571

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

Hub/start-selenium-hub.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ if [ ! -z "$SE_OPTS" ]; then
1515
echo "Appending Selenium options: ${SE_OPTS}"
1616
fi
1717

18-
java ${JAVA_OPTS} -jar /opt/selenium/selenium-server-standalone.jar \
18+
java ${JAVA_OPTS} -cp ${JAVA_CLASSPATH:-"/opt/selenium/*:."} org.openqa.grid.selenium.GridLauncherV3 \
1919
-role hub \
2020
-hubConfig ${CONF} \
2121
${SE_OPTS}

NodeBase/start-selenium-node.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,9 @@ fi
3636

3737
rm -f /tmp/.X*lock
3838

39-
java ${JAVA_OPTS} -jar /opt/selenium/selenium-server-standalone.jar \
39+
java ${JAVA_OPTS} -cp ${JAVA_CLASSPATH:-"/opt/selenium/*:."} org.openqa.grid.selenium.GridLauncherV3 \
4040
-role node \
4141
-hub http://$HUB_PORT_4444_TCP_ADDR:$HUB_PORT_4444_TCP_PORT/grid/register \
4242
${REMOTE_HOST_PARAM} \
4343
-nodeConfig /opt/selenium/config.json \
4444
${SE_OPTS}
45-

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,14 @@ You can pass `SE_OPTS` variable with additional commandline parameters for start
223223
$ docker run -d -p 4444:4444 -e SE_OPTS="-debug" --name selenium-hub selenium/hub:3.141.59-radium
224224
```
225225

226+
### JAVA_CLASSPATH Java classpath
227+
228+
By default, `CLASSPATH` for Java is `/opt/selenium/*:.` but you can overwrite it with yours using `JAVA_CLASSPATH`. This is useful when you want to use your own JAR files. Note that `/opt/selenium/*` always needs to be included because the Selenium JAR file is in the directory.
229+
230+
```bash
231+
$ docker run -d -p 4444:4444 -v $(pwd):/mnt -e JAVA_CLASSPATH="/mnt/*:/opt/selenium/*:." -e SE_OPTS="-servlets com.example.your.AwesomeServlet" --name selenium-hub selenium/hub:3.141.59-radium
232+
```
233+
226234
### Selenium Hub and Node Configuration options
227235

228236
For special network configurations or when the hub and the nodes are running on different machines `HUB_HOST` and `HUB_PORT`
@@ -285,7 +293,7 @@ To avoid starting the server you can set the `START_XVFB` environment variable t
285293

286294
``` bash
287295
$ docker run -d --net grid -e HUB_HOST=selenium-hub -e START_XVFB=false -v /dev/shm:/dev/shm selenium/node-chrome
288-
```
296+
```
289297

290298
For more information, see this Github [issue](https://github.com/SeleniumHQ/docker-selenium/issues/567).
291299

Standalone/start-selenium-standalone.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
#
33
# IMPORTANT: Change this file only in directory Standalone!
44

5-
java ${JAVA_OPTS} -jar /opt/selenium/selenium-server-standalone.jar \
5+
java ${JAVA_OPTS} -cp ${JAVA_CLASSPATH:-"/opt/selenium/*:."} org.openqa.grid.selenium.GridLauncherV3 \
66
${SE_OPTS}

0 commit comments

Comments
 (0)