F
F
fortran2014-06-27 09:05:04
Java
fortran, 2014-06-27 09:05:04

How to fix an error when trying to create a synthesizer (Java)?

Hello!
I recently started learning Java. Now I'm trying to implement an example from a book.
IDE - eclipce I
create as follows:

import javax.sound.midi.*;
import java.io.*;
import java.util.*;
public class MusicTest1 {
  public void play(){
        Sequencer sequencer = MidiSystem.getSequencer();
      System.out.println("Мы получили синтезатор");

  }
  public static void main(String[] args){
    MusicTest1 mt = new MusicTest1();
    mt.play();
  }
}

I get:
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
sequencer cannot be resolved to a variable
MidiSystem cannot be resolved
What am I doing wrong?
_____________________________
Thank you all. Figured it out myself. In eclipce, in the project tree, it was necessary to delete and add the jre system Library.
After this operation, the compiler stopped "swearing" at the Sequencer type.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question