[J2ME QA]untrusted domain is not configured问题回应

news/2024/6/23 20:50:53

 [When]

第一次使用Netbean 4.0/5.0开发程序的时候,用户可能在运行程序时,遇到下面这种报错,导致模拟器一闪而过

正在通过存储根 DefaultColorPhone 来运行
域名不正确,请切换到 'untrusted'
java.lang.SecurityException: untrusted domain is not configured

        at com.sun.midp.security.Permissions.forDomain(Permissions.java:530)
        at com.sun.midp.dev.DevMIDletSuiteImpl.create(DevMIDletSuiteImpl.java:148)
        at com.sun.midp.dev.DevMIDletSuiteImpl.create(DevMIDletSuiteImpl.java:91)
        at com.sun.midp.main.Main.runLocalClass(Main.java:453)
        at com.sun.midp.main.Main.main(Main.java:126)
Execution completed.

 

[HowTo]

可能导致的原因之一:

用户的Windows登录用户名是中文的,或者用户的程序路径中有中文。

 

原因之二:

Netbean中有相应的信任域的设置方式。可能用户没有设置。

建议用户在NetBean选中项目,然后右键à属性,找到运行, 然后配置一下里面的域,按照他说的选择untrusted

[More Details]

因为Netbean会在c:/document and settings/${username}/建一个.netbean的子目录,并将一些相关的属性与设定均建于该目录下,但由于Netbean使用简体中文,如果${username}是中文字,将因无法确认untrusted domain的路径而导致其认定错误

修改方法:

Netbean安装完且尚未执行前,先至 ” C:/Program Files/netbeans-5.0/etc” 下找netbeans.conf档,并于其中找到下列内容
# netbeans_default_userdir="${HOME}/.netbeans/5.0"
修改成netbeans_default_userdir="F:/prog/JAVA/.netbeans/5.0" 后,再启动netbean即可(上述目录可视需要改变,但建议最好为纯英文字)

And

 

Understanding Protection Domains

A protection comprises two parts:

  1. Permissions which are allowed (granted to contained MIDlet suites), and permissions for which the user must be consulted
  2. Criteria for entry into the protection domain

When you click on the Run button in the J2ME Wireless Toolkit, the current MIDlet suite is run in a protection domain called Untrusted. In this domain, the user is consulted for all permissions. That's why the emulator prompts you for permission when HTTPMIDlet attempts its HTTP connection.

You can change the MIDlet suite's runtime protection domain by choosing Edit -> Preferences, then clicking on the Security tab:


Selecting a Protection Domain
(Click for the full image.)

The J2ME Wireless Toolkit includes four protection domains. MIDlets in the Minimum domain are denied all permissions. The Untrusted domain prompts the user for every permission. The Trusted domain is a kind of MIDlet security nirvana where all permissions are granted; it's equivalent to Maximum.

 

[Tips]

鉴于从C++开发,到Java开发,许许多多的人都遇到过类似的问题。所以我们强烈建议:

1:你的Windows用户名千万避免有中文字符;

2:你的程序运行路径或者工程路径或者组件注册路径,避免有中文字符;

3:作为一个专职开发者,请养成起英文文件夹名的好习惯;

 





http://www.niftyadmin.cn/n/3649736.html

相关文章

[j2me]二级菜单演示 开源声明

郑昀ultrapower产品名称产品版本Keyword: JavaME 二级菜单MenuBarlet1.0.20[J2ME]二级菜单演示(MenuBarlet)开源说明我的资源:http://www.cnblogs.com/Files/zhengyun_ustc/menubar-1.0.20-src.rar这个1.0.20版本的j2me软件,能够在Nokia S60系列、索爱K7…

react ui 组件_如何使用React和Storybook构建UI组件

react ui 组件介绍 (Introduction) In the previous article, I gave an Introduction to Storybook and how it can be used to organize and build JavaScript components. Storybook is a UI library that can be used to document components. In this article, I’ll be e…

了解JavaScript中的变量范围

The scope is the execution context of a variable or function. It defines what data it has access to. This concept may seem pretty straightforward, but has some important subtleties. 作用域是变量或函数的执行上下文。 它定义了它有权访问的数据。 这个概念可能看…

[j2me]二级菜单界面演练[四]

Opera Mini的菜单也是最下方绘制的矩形条,然后drawString上菜单命令,我也要这么做,毕竟这么做简单些。若要做到类似于ucweb那种几乎接近于Windows任务栏/工具栏的那种效果,还尚需时日。今日花费点时间调整到这样吧,把左…

[j2me]二级菜单界面演练[三][0215Update]

今日又花费了点时间,调整界面上各种按键之下的效果,比如:上下左右方向键的作用;点击一次“选择”左软键就是展开主菜单,再点击一次“选择”左软键的作用就是消隐主菜单;等等诸如此类的效果,和Wi…

如何安装svelte_Svelte 3入门

如何安装svelte介绍 (Introduction) When building applications with JavaScript, high performance and penetrability will always be at the crux of the decisions made by software developers. Svelte is a high-performance component framework for imperative code. …

如何使用信号量持续集成和交付将Node.js应用程序构建和部署到DigitalOcean Kubernetes

The author selected the Open Internet / Free Speech fund to receive a donation as part of the Write for DOnations program. 作者选择了“ 开放式互联网/言论自由”基金来接受捐赠,这是“ 为捐赠写信”计划的一部分。 介绍 (Introduction) Kubernetes allow…

[j2me]二级菜单界面演练[二]

全赖朋友指点迷津,终于调试出来些许效果。实际上调整这种Opera Mini风格的二级菜单效果,颇为费时费力,也颇为折磨人的锐气。我只能按照以前对付bloglines手机伴侣的制作手法,每日花费一点时间调试,但也并不投入过多的精…