Date: Tue, 12 Oct 2021 07:45:32 -0700 From: Pete Wright via questions <questions@freebsd.org> To: list-freebsd-questions@jyborn.se, questions@freebsd.org Subject: Re: Is there a way to get direct execution of java jar files in FreeBSD? Message-ID: <cc4e8c0e-fea8-8769-c229-12d5b49f5ceb@nomadlogic.org> In-Reply-To: <YWVZ1mr8CdnmZ4sg@pol-server.leissner.se> References: <YWVZ1mr8CdnmZ4sg@pol-server.leissner.se>
next in thread | previous in thread | raw e-mail | index | archive | help
On 10/12/21 2:48 AM, list-freebsd-questions@jyborn.se wrote: > I want to start a java jar file from inetd in FreeBSD 12. > > It seems I need to do this with the command java -jar xxx.jar, > since I can't find a way to get direct execution of jar files. > > The java -jar method works fine, but the problem is that xxx.jar > needs to know the IP address of the connecting client, and it should > get that via the function System.inheritedChannel(), but it doesn't. > > Could it be that the java -jar start method in inetd doesn't transfer > the client socket to xxx.jar? > > Anyway, that's why I wonder if there is a way to start xxx.jar without > java -jar. it really depends on how the Java program itself expects to be executed. I have some spring-boot services that work fine when started up via daemon(8) on FreeBSD. I actually use a wrapper shell script to prepare the app's appropriate environment variables then just have it execute "java -jar my-app.jar". this should also work fine under inetd but i would be careful there as often times spinning up the JRE is an expensive and time consuming operations, so if possible i'd suggest just running as a long running daemon. from what you describe above it sounds like it may be a bug in the app itself getting the IP addresses of clients. -p -- Pete Wright pete@nomadlogic.org @nomadlogicLA
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?cc4e8c0e-fea8-8769-c229-12d5b49f5ceb>