我在应用程序和小程序使用的类中包含此代码。
static
{
if (System.getProperty("os.name").startsWith("Windows"))
{
System.loadLibrary("extmapi");
}
}
不幸的是,当小程序加载此代码时,我收到一个错误,因为它无法加载“extmapi”库。
为了避免这个错误,我需要知道我正在运行的代码是Applet还是应用程序,这样我才能做到:
if (isApplet)
return;
else
//load library
我怎么知道我是否在 Applet 中运行?