Get server address in Java Web Start

How can I get the IP address of a server in my JavaWS application from which it was downloaded?

Thank!

+3
source share
2 answers

You will need to get jnlp.jar and add it to your application. I had to find it in the JDK samples and demos that are distributed separately from the JDK. I used this sample and demo question to find it. I was able to get it using a url like http://download.oracle.com/otn-pub/java/jdk/8u11-b12-demos/jdk-8u11-windows-i586-demos.zip

jnlp.jar , , URL- , , .

import javax.jnlp.*;

BasicService bs = (BasicService)ServiceManager.lookup("javax.jnlp.BasicService");
URL codebase = bs.getCodeBase();
0

Source: https://habr.com/ru/post/1795498/


All Articles