Intellij Idea execute java with sudo

I have a Java application that starts a Jetty server on port 80. Everything starts fine when I launch the application from the console:

sudo java -jar myapp.jar 

      

When I try to run my application from Intellij Idea I have:

Exception in thread "main" java.net.BindException: Permission denied
    at java.net.PlainDatagramSocketImpl.bind0(Native Method)
    at java.net.AbstractPlainDatagramSocketImpl.bind(AbstractPlainDatagramSocketImpl.java:95)
    at java.net.DatagramSocket.bind(DatagramSocket.java:376)
    at java.net.DatagramSocket.<init>(DatagramSocket.java:231)

      

Is there a way to run a java application with sudo from the IDE? As a workaround, I run Idea with sudo from the command line, which solved my problem, but Idea picked up some internal errors related to some misconfiguration, and I will not run the entire IDE as sudo.

+3


source to share





All Articles