spiderj
spiderj

Reputation: 41

jpackage command is not recognized

I am trying to package a jar file into an executable file using the jpackage tool in Java, but the command is not recognized in the command prompt using Windows 10 and Java version:

> java --version
java 17.0.1 2021-10-19 LTS
Java(TM) SE Runtime Environment (build 17.0.1+12-LTS-39)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.1+12-LTS-39, mixed mode, sharing)

I have the full JDK installed and the command javac is recognized.

I checked my computer with the "where java javac jpackage" command and it only found the first two in the CommonFiles folder.

I looked in the folder path "ProgramFiles\Java\jdk-17.0.1\jmods" and both the "jdk.jlink.jmod" and "jdk.jpackage.jmod" files are present.

Can someone please help me figure out why the tool isn't recognized by Windows?

Upvotes: 2

Views: 2810

Answers (1)

spiderj
spiderj

Reputation: 41

I found the issue to be the way my Environment Variables were set up for Java. To fix my problem, I went into the JAVA_HOME variable and changed the entry from

C:\ProgramFiles\Java\jdk-17.0.1\lib

to

C:\ProgramFiles\Java\jdk-17.0.1

Next I updated the path variable to include "%JAVA_HOME%\bin". Before I had it listed as C:\ProgramFiles\Java\jdk-17.0.1\bin. Both of these changes were made under the System variables using the "Edit" button. I want to thank dave_thompson_085 for pointing me in the right direction.

Upvotes: 2

Related Questions