Windows 10 JNI error while Java se and jdk are on latest update











up vote
0
down vote

favorite












My cmd gives me the following reply



Error: A JNI error has occurred, please check your installation and try 
again
Exception in thread "main" java.lang.UnsupportedClassVersionError:
musicplayer has been compiled by a more recent version of the Java Runtime
(class file version 55.0), this version of the Java Runtime only recognizes
class file versions up to 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)


I reinstalled Java SE and JDK multiple times. I also searched online or a solution for about an hour but couldnt find an awnser. I got Java SE and JDK on the latests version.
Java versions



Here is my code, regardless if the code does what its supposed to do, I would like to get it running



        import javax.sound.midi.InvalidMidiDataException;
import javax.sound.midi.MidiEvent;
import javax.sound.midi.MidiSystem;
import javax.sound.midi.MidiUnavailableException;
import javax.sound.midi.Sequence;
import javax.sound.midi.Sequencer;
import javax.sound.midi.ShortMessage;
import javax.sound.midi.Track;


public class MusicPlayer {

public static int frequencyToMidi(double frequency) {
//TODO return midi note. hint: round the result and cast it to an integer

double p;
p=69+12*(Math.log(frequency/440)/Math.log(2));
Math.round(p);
int pp = (int)(p);

return 0;
}

public static MidiEvent makeEvent(int command, int channel, int firstByte, int secondByte, int tick) throws InvalidMidiDataException {
//TODO return midi event. hint: use short message

ShortMessage msg = new ShortMessage();
msg.setMessage(command, channel, firstByte, secondByte);
MidiEvent event = new MidiEvent(msg, tick);

return null;
}

public static void addNote(Track track, int channel, int midiNoteNumber, int velocity, int tickOn, int tickOff) throws InvalidMidiDataException {
//TODO add note on/off. hint: use ShortMessage.NOTE_ON and ShortMessage.NOTE_OFF

MidiEvent event1 = makeEvent(ShortMessage.NOTE_ON, 1, midiNoteNumber, velocity, tickOn);
track.add(event1);
MidiEvent event2 = makeEvent(ShortMessage.NOTE_OFF, 1, midiNoteNumber, velocity, tickOff);
track.add(event2);
}

public static void fillTrack(Track track) throws InvalidMidiDataException {

MidiEvent event3 = makeEvent(ShortMessage.CONTROL_CHANGE, 1, 127, 1, 0);
track.add(event3);
MidiEvent event4 = makeEvent(ShortMessage.PROGRAM_CHANGE, 1, 1, 0, 0);
track.add(event4);


addNote(track, 1, frequencyToMidi(659.26), 100, 1, 3);
addNote(track, 1, frequencyToMidi(622.25), 100, 5, 7);
addNote(track, 1, frequencyToMidi(493.88), 100, 9, 11);
addNote(track, 1, frequencyToMidi(587.33), 100, 13, 15);
addNote(track, 1, frequencyToMidi(523.25), 100, 17, 19);
addNote(track, 1, frequencyToMidi(440), 100, 21, 25);

//TODO change control. hint: use ShortMessage.CONTROL_CHANGE
//TODO change program. hint: use ShortMessage.PROGRAM_CHANGE

//TODO add note using your implementation of addNote
}

public static void main(String args) throws MidiUnavailableException, InvalidMidiDataException {
//initializes a sequencer and creates a track on it with a tempo of 220 bpm
Sequencer sequencer = MidiSystem.getSequencer();
sequencer.open();

Sequence seq = new Sequence(Sequence.PPQ, 4);
Track track = seq.createTrack();

fillTrack(track);

sequencer.setSequence(seq);
sequencer.setTempoInBPM(220);

//plays the track
sequencer.start();
}


}










share|improve this question


























    up vote
    0
    down vote

    favorite












    My cmd gives me the following reply



    Error: A JNI error has occurred, please check your installation and try 
    again
    Exception in thread "main" java.lang.UnsupportedClassVersionError:
    musicplayer has been compiled by a more recent version of the Java Runtime
    (class file version 55.0), this version of the Java Runtime only recognizes
    class file versions up to 52.0
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.access$100(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)


    I reinstalled Java SE and JDK multiple times. I also searched online or a solution for about an hour but couldnt find an awnser. I got Java SE and JDK on the latests version.
    Java versions



    Here is my code, regardless if the code does what its supposed to do, I would like to get it running



            import javax.sound.midi.InvalidMidiDataException;
    import javax.sound.midi.MidiEvent;
    import javax.sound.midi.MidiSystem;
    import javax.sound.midi.MidiUnavailableException;
    import javax.sound.midi.Sequence;
    import javax.sound.midi.Sequencer;
    import javax.sound.midi.ShortMessage;
    import javax.sound.midi.Track;


    public class MusicPlayer {

    public static int frequencyToMidi(double frequency) {
    //TODO return midi note. hint: round the result and cast it to an integer

    double p;
    p=69+12*(Math.log(frequency/440)/Math.log(2));
    Math.round(p);
    int pp = (int)(p);

    return 0;
    }

    public static MidiEvent makeEvent(int command, int channel, int firstByte, int secondByte, int tick) throws InvalidMidiDataException {
    //TODO return midi event. hint: use short message

    ShortMessage msg = new ShortMessage();
    msg.setMessage(command, channel, firstByte, secondByte);
    MidiEvent event = new MidiEvent(msg, tick);

    return null;
    }

    public static void addNote(Track track, int channel, int midiNoteNumber, int velocity, int tickOn, int tickOff) throws InvalidMidiDataException {
    //TODO add note on/off. hint: use ShortMessage.NOTE_ON and ShortMessage.NOTE_OFF

    MidiEvent event1 = makeEvent(ShortMessage.NOTE_ON, 1, midiNoteNumber, velocity, tickOn);
    track.add(event1);
    MidiEvent event2 = makeEvent(ShortMessage.NOTE_OFF, 1, midiNoteNumber, velocity, tickOff);
    track.add(event2);
    }

    public static void fillTrack(Track track) throws InvalidMidiDataException {

    MidiEvent event3 = makeEvent(ShortMessage.CONTROL_CHANGE, 1, 127, 1, 0);
    track.add(event3);
    MidiEvent event4 = makeEvent(ShortMessage.PROGRAM_CHANGE, 1, 1, 0, 0);
    track.add(event4);


    addNote(track, 1, frequencyToMidi(659.26), 100, 1, 3);
    addNote(track, 1, frequencyToMidi(622.25), 100, 5, 7);
    addNote(track, 1, frequencyToMidi(493.88), 100, 9, 11);
    addNote(track, 1, frequencyToMidi(587.33), 100, 13, 15);
    addNote(track, 1, frequencyToMidi(523.25), 100, 17, 19);
    addNote(track, 1, frequencyToMidi(440), 100, 21, 25);

    //TODO change control. hint: use ShortMessage.CONTROL_CHANGE
    //TODO change program. hint: use ShortMessage.PROGRAM_CHANGE

    //TODO add note using your implementation of addNote
    }

    public static void main(String args) throws MidiUnavailableException, InvalidMidiDataException {
    //initializes a sequencer and creates a track on it with a tempo of 220 bpm
    Sequencer sequencer = MidiSystem.getSequencer();
    sequencer.open();

    Sequence seq = new Sequence(Sequence.PPQ, 4);
    Track track = seq.createTrack();

    fillTrack(track);

    sequencer.setSequence(seq);
    sequencer.setTempoInBPM(220);

    //plays the track
    sequencer.start();
    }


    }










    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      My cmd gives me the following reply



      Error: A JNI error has occurred, please check your installation and try 
      again
      Exception in thread "main" java.lang.UnsupportedClassVersionError:
      musicplayer has been compiled by a more recent version of the Java Runtime
      (class file version 55.0), this version of the Java Runtime only recognizes
      class file versions up to 52.0
      at java.lang.ClassLoader.defineClass1(Native Method)
      at java.lang.ClassLoader.defineClass(Unknown Source)
      at java.security.SecureClassLoader.defineClass(Unknown Source)
      at java.net.URLClassLoader.defineClass(Unknown Source)
      at java.net.URLClassLoader.access$100(Unknown Source)
      at java.net.URLClassLoader$1.run(Unknown Source)
      at java.net.URLClassLoader$1.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)


      I reinstalled Java SE and JDK multiple times. I also searched online or a solution for about an hour but couldnt find an awnser. I got Java SE and JDK on the latests version.
      Java versions



      Here is my code, regardless if the code does what its supposed to do, I would like to get it running



              import javax.sound.midi.InvalidMidiDataException;
      import javax.sound.midi.MidiEvent;
      import javax.sound.midi.MidiSystem;
      import javax.sound.midi.MidiUnavailableException;
      import javax.sound.midi.Sequence;
      import javax.sound.midi.Sequencer;
      import javax.sound.midi.ShortMessage;
      import javax.sound.midi.Track;


      public class MusicPlayer {

      public static int frequencyToMidi(double frequency) {
      //TODO return midi note. hint: round the result and cast it to an integer

      double p;
      p=69+12*(Math.log(frequency/440)/Math.log(2));
      Math.round(p);
      int pp = (int)(p);

      return 0;
      }

      public static MidiEvent makeEvent(int command, int channel, int firstByte, int secondByte, int tick) throws InvalidMidiDataException {
      //TODO return midi event. hint: use short message

      ShortMessage msg = new ShortMessage();
      msg.setMessage(command, channel, firstByte, secondByte);
      MidiEvent event = new MidiEvent(msg, tick);

      return null;
      }

      public static void addNote(Track track, int channel, int midiNoteNumber, int velocity, int tickOn, int tickOff) throws InvalidMidiDataException {
      //TODO add note on/off. hint: use ShortMessage.NOTE_ON and ShortMessage.NOTE_OFF

      MidiEvent event1 = makeEvent(ShortMessage.NOTE_ON, 1, midiNoteNumber, velocity, tickOn);
      track.add(event1);
      MidiEvent event2 = makeEvent(ShortMessage.NOTE_OFF, 1, midiNoteNumber, velocity, tickOff);
      track.add(event2);
      }

      public static void fillTrack(Track track) throws InvalidMidiDataException {

      MidiEvent event3 = makeEvent(ShortMessage.CONTROL_CHANGE, 1, 127, 1, 0);
      track.add(event3);
      MidiEvent event4 = makeEvent(ShortMessage.PROGRAM_CHANGE, 1, 1, 0, 0);
      track.add(event4);


      addNote(track, 1, frequencyToMidi(659.26), 100, 1, 3);
      addNote(track, 1, frequencyToMidi(622.25), 100, 5, 7);
      addNote(track, 1, frequencyToMidi(493.88), 100, 9, 11);
      addNote(track, 1, frequencyToMidi(587.33), 100, 13, 15);
      addNote(track, 1, frequencyToMidi(523.25), 100, 17, 19);
      addNote(track, 1, frequencyToMidi(440), 100, 21, 25);

      //TODO change control. hint: use ShortMessage.CONTROL_CHANGE
      //TODO change program. hint: use ShortMessage.PROGRAM_CHANGE

      //TODO add note using your implementation of addNote
      }

      public static void main(String args) throws MidiUnavailableException, InvalidMidiDataException {
      //initializes a sequencer and creates a track on it with a tempo of 220 bpm
      Sequencer sequencer = MidiSystem.getSequencer();
      sequencer.open();

      Sequence seq = new Sequence(Sequence.PPQ, 4);
      Track track = seq.createTrack();

      fillTrack(track);

      sequencer.setSequence(seq);
      sequencer.setTempoInBPM(220);

      //plays the track
      sequencer.start();
      }


      }










      share|improve this question













      My cmd gives me the following reply



      Error: A JNI error has occurred, please check your installation and try 
      again
      Exception in thread "main" java.lang.UnsupportedClassVersionError:
      musicplayer has been compiled by a more recent version of the Java Runtime
      (class file version 55.0), this version of the Java Runtime only recognizes
      class file versions up to 52.0
      at java.lang.ClassLoader.defineClass1(Native Method)
      at java.lang.ClassLoader.defineClass(Unknown Source)
      at java.security.SecureClassLoader.defineClass(Unknown Source)
      at java.net.URLClassLoader.defineClass(Unknown Source)
      at java.net.URLClassLoader.access$100(Unknown Source)
      at java.net.URLClassLoader$1.run(Unknown Source)
      at java.net.URLClassLoader$1.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)


      I reinstalled Java SE and JDK multiple times. I also searched online or a solution for about an hour but couldnt find an awnser. I got Java SE and JDK on the latests version.
      Java versions



      Here is my code, regardless if the code does what its supposed to do, I would like to get it running



              import javax.sound.midi.InvalidMidiDataException;
      import javax.sound.midi.MidiEvent;
      import javax.sound.midi.MidiSystem;
      import javax.sound.midi.MidiUnavailableException;
      import javax.sound.midi.Sequence;
      import javax.sound.midi.Sequencer;
      import javax.sound.midi.ShortMessage;
      import javax.sound.midi.Track;


      public class MusicPlayer {

      public static int frequencyToMidi(double frequency) {
      //TODO return midi note. hint: round the result and cast it to an integer

      double p;
      p=69+12*(Math.log(frequency/440)/Math.log(2));
      Math.round(p);
      int pp = (int)(p);

      return 0;
      }

      public static MidiEvent makeEvent(int command, int channel, int firstByte, int secondByte, int tick) throws InvalidMidiDataException {
      //TODO return midi event. hint: use short message

      ShortMessage msg = new ShortMessage();
      msg.setMessage(command, channel, firstByte, secondByte);
      MidiEvent event = new MidiEvent(msg, tick);

      return null;
      }

      public static void addNote(Track track, int channel, int midiNoteNumber, int velocity, int tickOn, int tickOff) throws InvalidMidiDataException {
      //TODO add note on/off. hint: use ShortMessage.NOTE_ON and ShortMessage.NOTE_OFF

      MidiEvent event1 = makeEvent(ShortMessage.NOTE_ON, 1, midiNoteNumber, velocity, tickOn);
      track.add(event1);
      MidiEvent event2 = makeEvent(ShortMessage.NOTE_OFF, 1, midiNoteNumber, velocity, tickOff);
      track.add(event2);
      }

      public static void fillTrack(Track track) throws InvalidMidiDataException {

      MidiEvent event3 = makeEvent(ShortMessage.CONTROL_CHANGE, 1, 127, 1, 0);
      track.add(event3);
      MidiEvent event4 = makeEvent(ShortMessage.PROGRAM_CHANGE, 1, 1, 0, 0);
      track.add(event4);


      addNote(track, 1, frequencyToMidi(659.26), 100, 1, 3);
      addNote(track, 1, frequencyToMidi(622.25), 100, 5, 7);
      addNote(track, 1, frequencyToMidi(493.88), 100, 9, 11);
      addNote(track, 1, frequencyToMidi(587.33), 100, 13, 15);
      addNote(track, 1, frequencyToMidi(523.25), 100, 17, 19);
      addNote(track, 1, frequencyToMidi(440), 100, 21, 25);

      //TODO change control. hint: use ShortMessage.CONTROL_CHANGE
      //TODO change program. hint: use ShortMessage.PROGRAM_CHANGE

      //TODO add note using your implementation of addNote
      }

      public static void main(String args) throws MidiUnavailableException, InvalidMidiDataException {
      //initializes a sequencer and creates a track on it with a tempo of 220 bpm
      Sequencer sequencer = MidiSystem.getSequencer();
      sequencer.open();

      Sequence seq = new Sequence(Sequence.PPQ, 4);
      Track track = seq.createTrack();

      fillTrack(track);

      sequencer.setSequence(seq);
      sequencer.setTempoInBPM(220);

      //plays the track
      sequencer.start();
      }


      }







      java windows cmd runtime-error






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 7 at 17:10









      C0ba

      11




      11





























          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53194428%2fwindows-10-jni-error-while-java-se-and-jdk-are-on-latest-update%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53194428%2fwindows-10-jni-error-while-java-se-and-jdk-are-on-latest-update%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown