Zimny Lech
Zimny Lech

Reputation: 41

Cannot run executable JAR file on another PC

I have a Java application exported into the executable JAR file, which I run from a Windows Forms app (via java -jar).

The solution works perfectly fine on my PC, but it won't run on other PCs. There is literally no output after running the JAR, no exception, no logs from log4j, the command line window closes without displaying anything.

I have:

I have no ideas left at this point. Any suggestions are highly appreciated.

EDIT: the JAR was made in Eclipse on Windows 7. The other PCs I tried this on all have Windows 7 or 10. I do not use JavaFX or Swing, it is a purely console-based application.

Upvotes: 0

Views: 581

Answers (1)

Zimny Lech
Zimny Lech

Reputation: 41

After some experimenting I found the answer:

When calling the JAR from WinForms, I was passing a file path as argument. I didn't put \" at the beginning and end of the argument, so passing a path containing one or more spaces resulted in a wrong number of arguments.

It just so happened that the project path on my first PC didn't contain any spaces, that's why it worked there.

Upvotes: 1

Related Questions