How do I run my application as superuser from Eclipse?

后端 未结 9 1490
闹比i
闹比i 2020-11-29 09:35

I\'m running in to an error when I try to run my server application from Eclipse. The error is java.net.BindException: Permission denied. I think this is be

相关标签:
9条回答
  • 2020-11-29 09:59

    A better answer, perhaps, if this serves your needs AND is possible, could be simple port redirection on your router.

    Instead of trying to force your linux/unix to open a reserved port, when you are only developing this now (not installing) and you want to run it in a debugger, set your router to redirect incoming (external) port 443 to a port that is more convenient for your current needs (say 4443).

    I think most routers support this, and if yours doesn't it gives your mum a good christmas or birthday present idea!

    0 讨论(0)
  • 2020-11-29 09:59

    I am writing C not Java but this should work in either case. I use remote debug - define a "remote" connection to LOCALHOST which allows you to specify the user you will connect with, specify ROOT. Then define a Remote Application in debug configuration connection: LOCALHOST. Be sure to check "skip download to target path" at the bottom of the main tab as well as under the connection properties window.

    0 讨论(0)
  • 2020-11-29 10:00

    As mentioned in this thread:

    In order to open a port below 1024 on Unix/Linux systems you need to be "root".

    I also used the argument -Dorg.eclipse.equinox.http.jetty.port=8080 to change the listen port, but this seems to be ignored (according to the stacktrace)

    Please use "-Dorg.osgi.service.http.port=8080".


    As mentioned in HTTP Service:

    • org.osgi.service.http.port - specifies the port number to use for the http serving. The default value for this property is 80 (which requires root permission), as per the OSGi specification.

    • org.osgi.service.http.port.secure - specifies the port number to use for secure http serving. The default value for this property is 443 (which requires root permission), as per the OSGi specification.

    Maybe if you try to modify that last property to a value above 1024 it could work without requiring any special privilege.

    0 讨论(0)
提交回复
热议问题