码迷,mamicode.com
首页 > 编程语言 > 详细

WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5

时间:2015-04-21 20:33:37      阅读:265      评论:0      收藏:0      [点我收藏+]

标签:

以下是我的程序(取自好headfirst Java):

 

 1 import javax.sound.midi.*;
 2 
 3 public class MiniMiniMusicApp {
 4     public static void main(String[] args) {
 5         MiniMiniMusicApp mini = new MiniMiniMusicApp();
 6         mini.play();
 7     }
 8     public void play() {
 9         try {
10             Sequencer player = MidiSystem.getSequencer();
11             player.open();
12             
13             Sequence seq = new Sequence(Sequence.PPQ, 4);
14             
15             Track track = seq.createTrack();
16             
17             ShortMessage a = new ShortMessage();
18             a.setMessage(144, 1, 44, 100);
19             MidiEvent noteOn = new MidiEvent(a, 1);
20             track.add(noteOn);
21             
22             ShortMessage b = new ShortMessage();
23             b.setMessage(128, 1, 44, 100);
24             MidiEvent noteOff = new MidiEvent(b, 16);
25             track.add(noteOff);
26             
27             player.setSequence(seq);
28             
29             player.start();
30         } catch (Exception ex) {
31             ex.printStackTrace();
32         }
33         
34     }
35 }

 

在win8.1出现的错误信息如下:

WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0 
x80000002. Windows RegCreateKeyEx(...) returned error code 5.
 

解决方法如下:

Step1:搜索并运行regedit.exe

Step2: 进入HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft,右击JavaSoft目录,选择新建->项(key),命名为Prefs

Step3: 重新编译即可。

WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5

标签:

原文地址:http://www.cnblogs.com/lzpadmin/p/4445251.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!