[When]
First use Netbean 4.0/5.0 DevelopmentProgramWhen running the program, the user may encounter the following error, causing the simulator to flash through :
Using the storage root Defacolorcolorphone To run
The domain name is incorrect. Switch '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. Java: 126)
Execution completed.
[Howto]
One of the possible causes:
User'sWindowsThe logon username is in Chinese, or the user's program path contains Chinese characters.
Cause 2:
NetbeanThere is a corresponding way to set the trust domain. You may not have set this parameter.
We recommend that you Netbean Select a project, right-click À Properties, find run, Then configure the domain in it and follow his selection Untrusted .
[ More details ]
" Because Netbean The C: \ document and Settings \ $ {username }\ Create one . Netbean And some related properties and settings are built under this directory. Netbean Use simplified Chinese,If $ {Username} It is a Chinese text and cannot be confirmed Untrusted domain Is identified as incorrect .
Modification method:
In Netbean Before installation, go "C: \ Program Files \ netbeans-5.0 \ etc" Find Netbeans. conf File, and find the following content
# Netbeans_default_userdir = "$ {home}/. netbeans/5.0"
Modify Netbeans_default_userdir = "F: \ prog \ Java \. netbeans \ 4.0" And then start Netbean You can. ( The preceding directory needs to be changed visually, but it is recommended that the directory be pure English ) .
"
And
"
Understanding protection Domains
A protection comprises two parts:
- Permissions which are allowed (granted to contained MIDlet suites), and permissions for which the user must be consulted
- Criteria for entry into the protection domain
When you click onRunButton in the j2e-wireless toolkit, the current MIDlet suite is run in a protection domain calledUntrusted
. In this domain, the user is consulted for all permissions. That's why the emulator prompts you for permission whenHttpmidlet
Attempts its HTTP connection.
You can change the MIDlet suite's runtime protection domain by choosingEdit-> preferences, Then clicking onSecurityTab:
Selecting a protection domain (Click for the full image .) |
The j2e-wireless Toolkit provided des four protection domains. midlets inMinimum
Domain are denied all permissions.Untrusted
Domain prompts the user for every permission.Trusted
Domain is a kind of MIDlet Security Nirvana where all permissions are granted; It's equivalentMaximum
.
"
[Tips]
In viewC ++Development,JavaMany developers have encountered similar problems. Therefore, we strongly recommend that:
1: YoursWindowsThe user name must not contain Chinese characters;
2: Your program running path, project path, or component registration path should not contain Chinese characters;
3 : As a full-time developer, please develop a good habit of English folder names.