Hi.
This is my code:
try { final BasicService bs; final URL codeBase; try { bs = (BasicService) ServiceManager.lookup( "javax.jnlp.BasicService"); codeBase = bs.getCodeBase(); System.out.println(codeBase); } catch (UnavailableServiceException ex) { Logger.getLogger(applet.class.getName()).log(Level.SEVERE, null, ex); } } catch (Exception catchMe) { }
and i get:
java.lang.NoClassDefFoundError: javax/jnlp/UnavailableServiceException Caused by: java.lang.ClassNotFoundException: javax.jnlp.UnavailableServiceException at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) Exception in thread "main" Java Result: 1
I know that this code will only work when i lunch my app using JWS, but is there a way to catch the exception if i lunch my app using jar archiwe? I need this to find out if user is lunching my app localy (using jar archiwe) instead of lunching it through jnlp file.
Thank you very much for your time