WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows R

如下是個人程序(取自headfirst Java):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出現的錯誤信息以下:node

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

解決方法以下:code

Step1:搜索並運行regedit.exeblog

Step2: 進入HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft,右擊JavaSoft目錄,選擇新建->項(key),命名爲Prefsget

Step3: 從新編譯便可。it

相關文章
相關標籤/搜索