I did this steps:
- Downloaded the agent.file into a local folder already configured at the agent configuration “Remote root directory”
- Inside this folder “jenkins-agent”, I’ve downloaded a .exe “64bits” from WinSW and created an xml file (both with name jenkins-agent) with the following content:
<service>
<id>jenkins8080agent</id>
<name>Jenkins Agent for jenkins:8080</name>
<description>This service is a service created from a minimal configuration</description>
<executable>C:\Program Files\Java\jdk-17\bin\java.exe</executable>
<argument>java -jar C:\Users\cttc\agent.jar -jnlpUrl http://localhost:8080/rparada/manage/computer/agent1/jenkins-agent.jnlp -secret 6a24e49160f6906a9f17fcb0dc97c98d13b8bcecb3cdf3e518cfed4c5398d5d3 -workDir "C:\Users\cttc\jenkins-agent"</argument>
<log mode="roll" />
<onfailure action="restart" />
</service>
The argument tag was copied from the command provided by Jenkins
4) Open a cmd (administrator) and execute jenkins-agent.exe start
This action generated diverse files: …err.log / …wrapper.log and /…out.log. Unfortunately, it should create the folder named remoting as indicated at Internal data directory and, inside err.log I found this message:
Error: Could not find or load main class java -jar C:\Users\cttc\agent.jar -jnlpUrl http:..localhost:8080.rparada.manage.computer.agent1.jenkins-agent.jnlp -secret 6a24e49160f6906a9f17fcb0dc97c98d13b8bcecb3cdf3e518cfed4c5398d5d3 -workDir C:\Users\cttc\jenkins-agent
Caused by: java.lang.ClassNotFoundException: java -jar C:\Users\cttc\agent/jar -jnlpUrl http://localhost:8080/rparada/manage/computer/agent1/jenkins-agent/jnlp -secret 6a24e49160f6906a9f17fcb0dc97c98d13b8bcecb3cdf3e518cfed4c5398d5d3 -workDir C:\Users\cttc\jenkins-agent
I don’t know what I’m missing, I’ve been following this video How to Install Jenkins Agent on Windows - YouTube