Error launching Spectrum OneClick custom menu pick using a MAC OneClick client

Document ID : KB000008022
Last Modified Date : 14/02/2018
Show Technical Document Details
Issue:

A custom Spectrum OneClick menu pick to launch a web page is successful if the client system is Windows but fails if the client system is a MAC.

When launched using a MAC client, the user sees the following error:

"SPC-OCC-10262: Error launching https://my.webpage.com/devices/search?regex=1.2.3.4$. java.lang.NoClassDefFondError:Could not initialize class com.aprisma.util.BrowerLauncher."

 

The following is an example of the custom Spectrum OneClick menu pick:

 

<item name="My Menu Item"> 

<hot-key>VK_I</hot-key> 

<popup-visibility>always</popup-visibility> 

<action> 

<launch-browser> 

<url>https://my.webpage.com/devices/search?regex={0}$</url> 

<param> 

<attribute>AttributeID.NETWORK_ADDRESS</attribute> 

</param>

<param><expression>com.aprisma.spectrum.app.util.context.DefaultApplicationContext.getGlobalParameter(com.aprisma.spectrum.app.util.context.ApplicationContext.USER_PARAMETER_NAME) 

</expression> 

</param> 

</launch-browser> 

</action> 

</item> 

 

Cause:

This appears to be a java issue. Please read below concerning the BrowserLauncher class. Especially the last paragraph for system requirements concerning the MAC. 

BrowserLauncher is a class that provides one static method, openURL, which opens the default web browser for the current user of the system to the given URL. It may support other protocols depending on the system -- mailto, ftp, etc. -- but that has not been rigorously tested and is not guaranteed to work. 

Yes, this is platform-specific code, and yes, it may rely on classes on certain platforms that are not part of the standard JDK. What we're trying to do, though, is to take something that's frequently desirable but inherently platform-specific -- opening a default browser -- and allow programmers (you, for example) to do so without worrying about dropping into native code or doing anything else similarly evil. 

Anyway, this code is completely in Java and will run on all JDK 1.1-compliant systems without modification or a need for additional libraries. All classes that are required on certain platforms to allow this to run are dynamically loaded at runtime via reflection and, if not found, will not cause this to do anything other than returning an error when opening the browser. 

There are certain system requirements for this class, as it's running through Runtime.exec(), which is Java's way of making a native system call. Currently, this requires that a Macintosh have a Finder which supports the GURL event, which is true for Mac OS 8.0 and 8.1 systems that have the Internet Scripting AppleScript dictionary installed in the Scripting Additions folder in the Extensions folder (which is installed by default as far as I know under Mac OS 8.0 and 8.1), and for all Mac OS 8.5 and later systems. On Windows, it only runs under Win32 systems (Windows 95, 98, and NT 4.0, as well as later versions of all). On other systems, this drops back from the inherently platform-sensitive concept of a default browser and simply attempts to launch Netscape via a shell command. 

Resolution:

As a work-around, use the <launch-application> tab instead of the <launch-browser> tab int he custom menu xml.

Additional Information:

NOTE: MAC clients are NOT officially supported for use with Spectrum OneClick.