2

I have a java program in a windows system and I need Jenkins job from my company Linux server to trigger the java program in windows machine.

The Java project is automation script built in selenium and can be converted to JAR file to invoke using Java -jar command.

But I am confused how to trigger jenkins job from Linux server to execute the Jar file in windows machine. Can someone tried this help me on this scenario?

  • Easy just do an SSH from Linux to Windows, once connection is set run your java command Java -jar SeliumTest – rohit thomas Jul 10 '18 at 03:16
  • Thanks for the answer @rohitthomas. After setting the connection how do I mention the path of jar file in the remote windows system from Jenkins(in Linux server). I am creating a freestyle project and how do I invoke the jar? – Mahesh Krishnan P Jul 10 '18 at 19:17
  • use the SSH over plugin....https://wiki.jenkins.io/display/JENKINS/Publish+Over+SSH+Plugin If you want to do it using pipeline then follow this https://stackoverflow.com/questions/50376212/how-to-publish-over-ssh-in-multibranch-pipeline-in-jenkins/50403660#50403660... hope it helps :) – rohit thomas Jul 11 '18 at 02:45
  • Thanks @rohitthomas, I will post result after trying this option. – Mahesh Krishnan P Jul 11 '18 at 19:34
  • I tried this from windows machine to Linux and worked well. – Mahesh Krishnan P Jul 24 '18 at 22:07

1 Answers1

1

You need to create master-slave in Jenkin.

Master would be your linux server Jenkin and configure as slave your window machine because your suite gonna run on WIndow machine.

Ankit Gupta
  • 776
  • 5
  • 12
  • Thanks for the answer @ankitgupta. After setting the connection how do I mention the path of jar file in the remote windows system from Jenkins(in Linux server). I am creating a freestyle project and how do I invoke the jar? – Mahesh Krishnan P Jul 10 '18 at 19:21
  • Once you done with the master-slave configuration then simple use shell execution or you can create a .bat file to run this. The better option which I choose create .bat file in a program hit that java file using Java or if you use Maven project then using pom.xml. – Ankit Gupta Jul 11 '18 at 12:32
  • Thanks @ankitgupta.Will try this and post the results. – Mahesh Krishnan P Jul 11 '18 at 19:36