• Post Reply Bookmark Topic Watch Topic
  • New Topic

java.util.prefs.WindowsPreferences <init> Java runtime error  RSS feed

 
Matthew Yeend
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am aware that this question can be found here but I don't know how to change the forums on an existing question that I've posted.

I'm creating a project in Java that the aim of is to load X3D and X3DV files. The Java class does work with X3D files that don't have any URLs in, but my task is to display X3D files that do include URLs, and when I run my Java project, I get the following error:

I'm creating this project in Netbeans 8.1, and I have X3D-Edit 3.3 installed onto Netbeans. The line in my Java code that loads the X3D files is:

Of what can understand, the line that loads the X3D files is the line that's causing the problem and I don't understand how to get rid of the error. Any help would be great, thanks.
 
Rob Spoor
Sheriff
Posts: 21131
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Matthew Yeend wrote:

That line tells you two things:
1) The system is trying to create registry key HKEY_LOCAL_MACHINE\Software\JavaSoft\Prefs (0x80000002 stands for HKEY_LOCAL_MACHINE).
2) You don't have access to create that registry key (error code 5 is ERROR_ACCESS_DENIED).

WindowsPreferences, the Windows implementation for Preferences, uses the registry to store its data. It has two root keys (JavaSoft is a legacy thing):
1) HKEY_LOCAL_MCAHINE\Software\JavaSoft\Prefs for the root Preferences object (Preferences.systemRoot()).
2) HKEY_CURRENT_USER\Software\JavaSoft\Prefs for the user Preferences object (Preferences.userRoot()).

Apparently your application is trying to use Preferences.systemRoot() but you don't have administrative rights. Either change the program to use Preferences.userRoot() instead, or run the program as an Administrator.
 
Matthew Yeend
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm making the program on my own laptop, so I am the administrator, I'll try and change the program to use 'Preferences.userRoot()'
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!