Gradle Run: Permission Denied

Hello, so I ran into this problem and I can’t seem to find a way to fix it. This used to work on other Linux distros (including Ubuntu 16.04), Windows 10 and Mac, but somehow it isn’t working on Elementary OS. I installed Gradle with SDKMan like I always did before on Unix-based systems, as they recommended it on their website and when I run “gradle build” and “gradle run”, the server would be working just fine.

Right now, I can only “gradle build”, whenever I use “gradle run”, I get this error:


Starting a Gradle Daemon (subsequent builds will be faster)
Download https://repo1.maven.org/maven2/org/xerial/sqlite-jdbc/3.16.1/sqlite-jdbc-3.16.1.pom
Download https://repo1.maven.org/maven2/org/sonatype/oss/oss-parent/9/oss-parent-9.pom
Download https://repo1.maven.org/maven2/org/json/json/20160810/json-20160810.pom
Download https://repo1.maven.org/maven2/org/xerial/sqlite-jdbc/3.16.1/sqlite-jdbc-3.16.1.jar
Download https://repo1.maven.org/maven2/org/json/json/20160810/json-20160810.jar
:compileJava UP-TO-DATE
:processResources NO-SOURCE
:classes UP-TO-DATE
:run
java.net.SocketException: Permission denied
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at sun.net.httpserver.ServerImpl.(ServerImpl.java:100)
at sun.net.httpserver.HttpServerImpl.(HttpServerImpl.java:50)
at sun.net.httpserver.DefaultHttpServerProvider.createHttpServer(DefaultHttpServerProvider.java:35)
at com.sun.net.httpserver.HttpServer.create(HttpServer.java:130)
at com.jewel_system.link_server.Start.createServer(Start.java:122)
at com.jewel_system.link_server.Start.main(Start.java:27)
:run FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:run’.

Process ‘command ‘/home/troopy712139/.sdkman/candidates/java/8u121/bin/java’’ finished with non-zero exit value 1

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 51.21 secs


I tried using “sudo gradle run” because it said “Permission Denied” but I get “sudo: gradle: command not found”.

This made me do a manual installation of Gradle by unzipping the file into a custom made directory and then adding that gradle/bin path to the Environment Variable. This still does the same thing.

Any idea on how I can fix this?