MrM
MrM

Reputation: 399

java jar not recognized as an internal or external command

I have both JDK and JRE installed.

PATH system variable is updated with path to JDK bin folder C:\Program Files\Java\jdk-11\bin

C:\Fitnesse>path
PATH=C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\oracle\product\12.2.0\client_1\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;"C:\Program Files\Java\jdk-11\bin";C:\Users\kks6037\AppData\Local\Microsoft\WindowsApps

C:\Fitnesse>

C:\Fitnesse>java -version
java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)

 C:\Fitnesse>-jar fitnesse-standalone.jar -p 80
'-jar' is not recognized as an internal or external command,
operable program or batch file.

C:\Fitnesse>

In order to execute fitnesse-standalone.jar i have to enter command: "java -jar fitnesse-standalone.jar -p 80"

From past experience I have never been forced to enter "java" in front of "-jar"? Is my environment variables somehow incorrect?

I have tried searching the forums for a solution, but with no luck..

Thanks.

Upvotes: 1

Views: 3140

Answers (3)

Irfan Bhindawala
Irfan Bhindawala

Reputation: 333

Create a command alias to get this customized behavior. for example alias name = java -jar, now whenever you want to run the command just use name jarname.jar -p 80.You can use whatever alias name you want.

Upvotes: 0

DodgyCodeException
DodgyCodeException

Reputation: 6123

From past experience I have never been forced to enter "java" in front of "-jar"

You are probably misremembering: if you have a file association for .jar files, then you don't need to enter "java -jar" in front of the jar. Just do this instead:

fitnesse-standalone.jar -p 80

This typically runs javaw.exe, the GUI version of java.exe, which doesn't have a console (and therefore no System.out etc). If the application is a console-based application, then you need to put java -jar in front to ensure you run the appropriate version of Java executable.

Upvotes: 1

SamHoque
SamHoque

Reputation: 3154

You need to use the name java before calling -jar so try calling this command

java -jar fitnesse-standalone.jar -p 80

Upvotes: 2

Related Questions