Techgration
Techgration

Reputation: 517

Can't pass parameters to JAR file from Powershell... works in command prompt

When I try to run the following in Powershell

& java -jar myEncrypter.jar abc123

I get the error:

SEVERE: null java.security.InvalidKeyException: Illegal key size

However, if I run this in a command prompt, it works

java -jar myEncrypter.jar abc123

Note: The path to Java, C:\Program Files (x86)\Java\jre6\bin, is setup correctly, so that is not the problem.

Upvotes: 0

Views: 4208

Answers (2)

Keith Hill
Keith Hill

Reputation: 201652

You're not running the same java exe between the two environments. Not sure why the Path is different between cmd.exe and PowerShell but it apparently is. Use a full path to java.exe or fix the path that PowerShell sees.

Upvotes: 3

Techgration
Techgration

Reputation: 517

Keith Hill was correct... I needed to reference C:\Program Files (x86)\Java\jre6\bin in both the path to the jar and the path to java.

C:\Program Files (x86)\Java\jre6\bin\java -jar C:\Program Files (x86)\Java\jre6\bin\myEncrypter.jar abc123

Upvotes: 0

Related Questions