# Cannot find Windows Agent command line to download jar file

**URL:** <https://community.jenkins.io/t/cannot-find-windows-agent-command-line-to-download-jar-file/6675>\
**Category:** Ask a question\
**Tags:** question\
**Created:** [April 4, 2023, 11:30am UTC](https://community.jenkins.io/t/cannot-find-windows-agent-command-line-to-download-jar-file/6675 "2023-04-04T11:30:51Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![raul-parada](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/raul-parada/32/3828_2.png) [@raul-parada](https://community.jenkins.io/u/raul-parada)\
**Post date:** [April 4, 2023, 11:30am UTC](https://community.jenkins.io/t/cannot-find-windows-agent-command-line-to-download-jar-file/6675/1 "2023-04-04T11:30:51Z")

</div>

Hi,

After creating an agent. I’ve received this message:

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/jenkins/original/2X/8/869ce58028b21af9d034b52d3cb76c73369b7b3f.png)

With two options to download the jar file. However, I cannot find any command line (console) on jenkins to execute the available code to download the jar file. My environment is Windows 10.

---

<div class="post-metadata">

**Author:** ![slide\_o\_mix](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/slide_o_mix/32/20977_2.png) [@slide\_o\_mix](https://community.jenkins.io/u/slide_o_mix)\
**Post date:** [April 4, 2023, 4:02pm UTC](https://community.jenkins.io/t/cannot-find-windows-agent-command-line-to-download-jar-file/6675/2 "2023-04-04T16:02:00Z")

</div>

What type of agent is it? SSH? JNLP? What does the log say (“See log for more details”).

---

<div class="post-metadata">

**Author:** ![raul-parada](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/raul-parada/32/3828_2.png) [@raul-parada](https://community.jenkins.io/u/raul-parada)\
**Post date:** [April 4, 2023, 4:10pm UTC](https://community.jenkins.io/t/cannot-find-windows-agent-command-line-to-download-jar-file/6675/3 "2023-04-04T16:10:18Z")

</div>

This is the type

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/jenkins/original/2X/2/2fe7e5f8936e284b089b4594e40084a404319b89.png)

This is the log:

```auto

SSHLauncher{host='localhost', port=22, credentialsId='rparada', jvmOptions='', javaPath='', prefixStartSlaveCmd='', suffixStartSlaveCmd='', launchTimeoutSeconds=60, maxNumRetries=10, retryWaitTime=15, sshHostKeyVerificationStrategy=hudson.plugins.sshslaves.verifiers.KnownHostsFileKeyVerificationStrategy, tcpNoDelay=true, trackCredentials=true}
[04/04/23 12:49:13] [SSH] Opening SSH connection to localhost:22.
Connection refused: no further information
SSH Connection failed with IOException: "Connection refused: no further information", retrying in 15 seconds. There are 10 more retries left.
Connection refused: no further information
SSH Connection failed with IOException: "Connection refused: no further information", retrying in 15 seconds. There are 9 more retries left.
Connection refused: no further information
SSH Connection failed with IOException: "Connection refused: no further information", retrying in 15 seconds. There are 8 more retries left.
Connection refused: no further information
SSH Connection failed with IOException: "Connection refused: no further information", retrying in 15 seconds. There are 7 more retries left.
Connection refused: no further information
SSH Connection failed with IOException: "Connection refused: no further information", retrying in 15 seconds. There are 6 more retries left.
Connection refused: no further information
SSH Connection failed with IOException: "Connection refused: no further information", retrying in 15 seconds. There are 5 more retries left.
Connection refused: no further information
SSH Connection failed with IOException: "Connection refused: no further information", retrying in 15 seconds. There are 4 more retries left.
Connection refused: no further information
SSH Connection failed with IOException: "Connection refused: no further information", retrying in 15 seconds. There are 3 more retries left.
Connection refused: no further information
SSH Connection failed with IOException: "Connection refused: no further information", retrying in 15 seconds. There are 2 more retries left.
Connection refused: no further information
SSH Connection failed with IOException: "Connection refused: no further information", retrying in 15 seconds. There are 1 more retries left.
Connection refused: no further information
ERROR: Connection is not established!
java.lang.IllegalStateException: Connection is not established!
	at com.trilead.ssh2.Connection.getRemainingAuthMethods(Connection.java:988)
	at com.cloudbees.jenkins.plugins.sshcredentials.impl.TrileadSSHPasswordAuthenticator.canAuthenticate(TrileadSSHPasswordAuthenticator.java:83)
	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:178)
	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.Spliterators$IteratorSpliterator.tryAdvance(Spliterators.java:1856)
	at java.base/java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:129)
	at java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:527)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:513)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:150)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:647)
	at com.cloudbees.jenkins.plugins.sshcredentials.SSHAuthenticator.newInstance(SSHAuthenticator.java:222)
	at com.cloudbees.jenkins.plugins.sshcredentials.SSHAuthenticator.newInstance(SSHAuthenticator.java:173)
	at hudson.plugins.sshslaves.SSHLauncher.openConnection(SSHLauncher.java:878)
	at hudson.plugins.sshslaves.SSHLauncher.lambda$launch$0(SSHLauncher.java:434)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:833)
[04/04/23 12:51:58] Launch failed - cleaning up connection
[04/04/23 12:51:58] [SSH] Connection closed.

```

---

<div class="post-metadata">

**Author:** ![slide\_o\_mix](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/slide_o_mix/32/20977_2.png) [@slide\_o\_mix](https://community.jenkins.io/u/slide_o_mix)\
**Post date:** [April 4, 2023, 4:14pm UTC](https://community.jenkins.io/t/cannot-find-windows-agent-command-line-to-download-jar-file/6675/4 "2023-04-04T16:14:49Z")

</div>

That doesn’t make any sense, you have the agent setup such that it should be connecting to the controller, so there shouldn’t be anything about SSH at all in the logs. When you select the option you have selected, you should have to launch the agent via the agent.jar yourself.

---

<div class="post-metadata">

**Author:** ![raul-parada](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/raul-parada/32/3828_2.png) [@raul-parada](https://community.jenkins.io/u/raul-parada)\
**Post date:** [April 5, 2023, 4:49am UTC](https://community.jenkins.io/t/cannot-find-windows-agent-command-line-to-download-jar-file/6675/5 "2023-04-05T04:49:17Z")

</div>

I guess the log was from the previous setup. I deleted that one and created a new one, I could download the agent.jar inside the remote folder on my pc. Now, in the log appears dots appearing without text. The status of the agent stills shows a red cross. And in the section projects tied to agent1 (the name of the agent), shows None. I want to be tied to a project called pythonCookies. I don’t know where to configure it. Thanks

---

<div class="post-metadata">

**Author:** ![slide\_o\_mix](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/slide_o_mix/32/20977_2.png) [@slide\_o\_mix](https://community.jenkins.io/u/slide_o_mix)\
**Post date:** [April 5, 2023, 2:13pm UTC](https://community.jenkins.io/t/cannot-find-windows-agent-command-line-to-download-jar-file/6675/6 "2023-04-05T14:13:16Z")

</div>

Did you run the agent.jar on the system to connect the agent to the controller? When using the option you selected, you have to run the agent.jar from the agent system so that it connects to the controller and can run jobs.

---

<div class="post-metadata">

**Author:** ![raul-parada](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/raul-parada/32/3828_2.png) [@raul-parada](https://community.jenkins.io/u/raul-parada)\
**Post date:** [April 5, 2023, 2:51pm UTC](https://community.jenkins.io/t/cannot-find-windows-agent-command-line-to-download-jar-file/6675/7 "2023-04-05T14:51:15Z")

</div>

I did this steps:

1. Downloaded the agent.file into a local folder already configured at the agent configuration “Remote root directory”
2. 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:

```auto
<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:

```auto
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](https://www.youtube.com/watch?v=N8AQTlHoBKc&t=138s)

---

<div class="post-metadata">

**Author:** ![slide\_o\_mix](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/slide_o_mix/32/20977_2.png) [@slide\_o\_mix](https://community.jenkins.io/u/slide_o_mix)\
**Post date:** [April 8, 2023, 12:39am UTC](https://community.jenkins.io/t/cannot-find-windows-agent-command-line-to-download-jar-file/6675/8 "2023-04-08T00:39:03Z")

</div>

Remove java from the arguments, it should only be the arguments to pass to java.exe not the executable as well.

---

<div class="post-metadata">

**Author:** ![raul-parada](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/raul-parada/32/3828_2.png) [@raul-parada](https://community.jenkins.io/u/raul-parada)\
**Post date:** [April 8, 2023, 1:40pm UTC](https://community.jenkins.io/t/cannot-find-windows-agent-command-line-to-download-jar-file/6675/9 "2023-04-08T13:40:41Z")

</div>

I get this error:

```auto
Unrecognized option: -jar agent.jar -jnlpUrl http://localhost:8080/rparada/manage/computer/agent1/jenkins-agent.jnlp -secret 6a24e49160f6906a9f17fcb0dc97c98d13b8bcecb3cdf3e518cfed4c5398d5d3 -workDir C:\Users\cttc\jenkins-agent
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

```

---

<div class="post-metadata">

**Author:** ![slide\_o\_mix](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/slide_o_mix/32/20977_2.png) [@slide\_o\_mix](https://community.jenkins.io/u/slide_o_mix)\
**Post date:** [April 8, 2023, 5:42pm UTC](https://community.jenkins.io/t/cannot-find-windows-agent-command-line-to-download-jar-file/6675/10 "2023-04-08T17:42:21Z")

</div>

Take a look at the same video at this point, it shows the setup that you should be using.

[![](https://europe1.discourse-cdn.com/flex013/uploads/jenkins/original/2X/6/6b0aa853c2e875e7b65202250560fd82bcea70b6.jpeg "How to Install Jenkins Agent on Windows") ](https://www.youtube.com/watch?v=N8AQTlHoBKc)

---

<div class="post-metadata">

**Author:** ![raul-parada](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/raul-parada/32/3828_2.png) [@raul-parada](https://community.jenkins.io/u/raul-parada)\
**Post date:** [April 10, 2023, 9:33pm UTC](https://community.jenkins.io/t/cannot-find-windows-agent-command-line-to-download-jar-file/6675/11 "2023-04-10T21:33:23Z")

</div>

I have the same xml content (I’ve just added the path to the agent.jar).

```auto
<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>-jar C:\Users\cttc\jenkins-agent\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>

```

However, I still get the same error. Is it because I have java 17 instead of 11?

---

<div class="post-metadata">

**Author:** ![slide\_o\_mix](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/slide_o_mix/32/20977_2.png) [@slide\_o\_mix](https://community.jenkins.io/u/slide_o_mix)\
**Post date:** [April 10, 2023, 9:45pm UTC](https://community.jenkins.io/t/cannot-find-windows-agent-command-line-to-download-jar-file/6675/12 "2023-04-10T21:45:48Z")

</div>

No, Java 17 will work. Can you try running the following on the command line?

```auto
"C:\Program Files\Java\jdk-17\bin\java.exe" -jar C:\Users\cttc\jenkins-agent\agent.jar -jnlpUrl http://localhost:8080/rparada/manage/computer/agent1/jenkins-agent.jnlp -secret 6a24e49160f6906a9f17fcb0dc97c98d13b8bcecb3cdf3e518cfed4c5398d5d3 -workDir "C:\Users\cttc\jenkins-agent"

```

---

<div class="post-metadata">

**Author:** ![raul-parada](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/raul-parada/32/3828_2.png) [@raul-parada](https://community.jenkins.io/u/raul-parada)\
**Post date:** [April 10, 2023, 9:55pm UTC](https://community.jenkins.io/t/cannot-find-windows-agent-command-line-to-download-jar-file/6675/13 "2023-04-10T21:55:53Z")

</div>

I get this:

```auto
C:\Users\cttc>"C:\Program Files\Java\jdk-17\bin\java.exe" -jar C:\Users\cttc\jenkins-agent\agent.jar -jnlpUrl http://localhost:8080/rparada/manage/computer/agent1/jenkins-agent.jnlp -secret 6a24e49160f6906a9f17fcb0dc97c98d13b8bcecb3cdf3e518cfed4c5398d5d3 -workDir "C:\Users\cttc\jenkins-agent"
Apr 10, 2023 11:54:35 PM org.jenkinsci.remoting.engine.WorkDirManager initializeWorkDir
INFO: Using C:\Users\cttc\jenkins-agent\remoting as a remoting work directory
Apr 10, 2023 11:54:35 PM org.jenkinsci.remoting.engine.WorkDirManager setupLogging
INFO: Both error and output logs will be printed to C:\Users\cttc\jenkins-agent\remoting
Failed to obtain http://localhost:8080/rparada/manage/computer/agent1/jenkins-agent.jnlp?encrypt=true
java.io.IOException: Failed to load http://localhost:8080/rparada/manage/computer/agent1/jenkins-agent.jnlp?encrypt=true: 403 Forbidden
        at hudson.remoting.Launcher.parseJnlpArguments(Launcher.java:514)
        at hudson.remoting.Launcher.run(Launcher.java:346)
        at hudson.remoting.Launcher.main(Launcher.java:297)
Waiting 10 seconds before retry

```

---

<div class="post-metadata">

**Author:** ![slide\_o\_mix](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/slide_o_mix/32/20977_2.png) [@slide\_o\_mix](https://community.jenkins.io/u/slide_o_mix)\
**Post date:** [April 10, 2023, 10:44pm UTC](https://community.jenkins.io/t/cannot-find-windows-agent-command-line-to-download-jar-file/6675/14 "2023-04-10T22:44:47Z")

</div>

Ok, well that is a problem. Are you sure the Jenkins URL is correct? Are you running the agent on the same host as the server?

---

<div class="post-metadata">

**Author:** ![raul-parada](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/raul-parada/32/3828_2.png) [@raul-parada](https://community.jenkins.io/u/raul-parada)\
**Post date:** [April 10, 2023, 10:58pm UTC](https://community.jenkins.io/t/cannot-find-windows-agent-command-line-to-download-jar-file/6675/15 "2023-04-10T22:58:12Z")

</div>

Jenkins was installed locally and the agent content is also located inside the same host. I only use localhost address. So, I access Jenkins using localhost:8080.

---

<div class="post-metadata">

**Author:** ![slide\_o\_mix](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/slide_o_mix/32/20977_2.png) [@slide\_o\_mix](https://community.jenkins.io/u/slide_o_mix)\
**Post date:** [April 10, 2023, 11:10pm UTC](https://community.jenkins.io/t/cannot-find-windows-agent-command-line-to-download-jar-file/6675/16 "2023-04-10T23:10:06Z")

</div>

Can you access this URL from a browser as the same user? [http://localhost:8080/rparada/manage/computer/agent1/jenkins-agent.jnlp?encrypt=true](http://localhost:8080/rparada/manage/computer/agent1/jenkins-agent.jnlp?encrypt=true)

---

<div class="post-metadata">

**Author:** ![raul-parada](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/raul-parada/32/3828_2.png) [@raul-parada](https://community.jenkins.io/u/raul-parada)\
**Post date:** [April 11, 2023, 6:54am UTC](https://community.jenkins.io/t/cannot-find-windows-agent-command-line-to-download-jar-file/6675/17 "2023-04-11T06:54:57Z")

</div>

When using that link, appears the regular fields to insert my credentials to access to jenkins but I doesn’t, instead, I receive this error:  
 ![image](https://europe1.discourse-cdn.com/flex013/uploads/jenkins/original/2X/b/bee6addf75cd2026d6de2c5c3b0e73ee09e89dfa.png)

---

<div class="post-metadata">

**Author:** ![slide\_o\_mix](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/slide_o_mix/32/20977_2.png) [@slide\_o\_mix](https://community.jenkins.io/u/slide_o_mix)\
**Post date:** [April 14, 2023, 3:00am UTC](https://community.jenkins.io/t/cannot-find-windows-agent-command-line-to-download-jar-file/6675/18 "2023-04-14T03:00:44Z")

</div>

Are you sure you setup the agent in the jenkins configuration already?

---

<div class="post-metadata">

**Author:** ![raul-parada](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/raul-parada/32/3828_2.png) [@raul-parada](https://community.jenkins.io/u/raul-parada)\
**Post date:** [April 14, 2023, 6:49am UTC](https://community.jenkins.io/t/cannot-find-windows-agent-command-line-to-download-jar-file/6675/19 "2023-04-14T06:49:30Z")

</div>

This is the current agent configuration:

Name: agent1  
Number of executors: 1  
Remote root directory: C:\Users\user\jenkins-agent  
Labels: pythonCookies (same name as the task)  
Usage: Only build jobs with labels expressions matching this node  
Launch method: Launch agent by connecting it to the controller  
Enable Disable WorkDir  
Internal data directory: remoting  
Enable Use WebSocket  
Availability: Keep this agent online as much as possible

With this folder structure in jenkins-agent:

![image](https://europe1.discourse-cdn.com/flex013/uploads/jenkins/original/2X/5/5efd6b756754c86967d6c448c4fb85c426bad82e.png)

I’ve followed are guidelines from the video, but still getting same error.

---

<div class="post-metadata">

**Author:** ![slide\_o\_mix](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/slide_o_mix/32/20977_2.png) [@slide\_o\_mix](https://community.jenkins.io/u/slide_o_mix)\
**Post date:** [April 14, 2023, 3:09pm UTC](https://community.jenkins.io/t/cannot-find-windows-agent-command-line-to-download-jar-file/6675/20 "2023-04-14T15:09:35Z")

</div>

I don’t know what the issue is, sorry.

[Next page](https://community.jenkins.io/t/cannot-find-windows-agent-command-line-to-download-jar-file/6675.md?page=2)
