Why can't I execute the line code (.bat/.sh) in IntelliJ?

Hello, I have a problem with IntelliJ.

I tried to follow a tutorial.

I did that, but then the problem arose. An error occurred, even though I followed the tutorial exactly. It's about me not being able to open a file. When I click "open it" and then click on the file, CMD just displays an error message saying it didn't work.

I used both versions: .bat and .sh.

If you would like me to show you pictures of the items, please ask.

Video: https://www.youtube.com/watch?v=HuYs2Vp3GtM , minute 34:00

.sh:

1 vote, average: 1.00 out of 1 (1 rating, 1 votes, rated)
You need to be a registered member to rate this.
Loading...
Subscribe
Notify of
1 Answer
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
regex9
10 months ago

I don't understand why the tutor writes an extra script. IntelliJ already delivers functionality. All you need is: Run Configuration to create. A complete tutorial on how to create a Java program in IntelliJ, with a JAR deployed and executed, you can also find it in the JetBrains documentation (see Create your first Java application ).

Regarding error message: either the system cannot find the file or has no reading rights.

  • Look at the JAR file (or its properties) via the Windows File Explorer.
  • Try moving (to another folder) and/or renaming the file. The path in the script should be adjusted accordingly naturally.
 java -jar "c:\users\path\to\your\jar\file.jar"

PS.: Batchscripts (.bat) are for Windows OS, Shellscripts (.sh) are for Unix systems.

PPS: You should work urgently on your spelling, because it's really bad. At best, before you continue to learn programming, because there are no typing errors and the like.