Execute jar file with command line on Windows Server 2012
-
02-01-2020 - |
Question
I'm trying to execute a .jar file to update my Coldfusion server but when I type the following command into the command prompt (running as administrator) it tells me that the system cannot find the specified file.
W:\CF10> java -jar <hotfix11>.jar
The file is located in the CF10 folder on the W drive. I've also tried putting the full file path in the <> of the command but had the same results.
Any thoughts on what I'm doing wrong?
Thanks
La solution
The Java bin directory is not part of the Windows system PATH by default. Because you are attempting to run the Java executable from your W:\CF10
directory you are getting that error. The error is not referencing the JAR file but the Java executable itself. Windows can't find it from that directory so you need to include the path in your command line.
Something like this for example:
W:\CF10> "c:\program files\java\jre7\bin\java" -jar <hotfix11>.jar
You can test if the Java bin directory is in your system PATH by simply typing java
at your command prompt from the W:\CF10>
directory. If you get the same error than it is not. If you see the command line options for the Java command then it is and you have some other problem.
James just made a valid comment - for ColdFusion 10 hotfixes are applied via the ColdFusion administrator.