Uncompilable source code - Erroneous sym type: jav

2019-03-07 05:17发布

import java.io.File;

import java.io.FileInputStream;

//import javax.swing.JFrame;
public class filterpanitha {
//public void graph(){

//}
/**
 * @param args
 */
public static void main(String[] args) {
    // First, get the data from a sound file in .wav format into your program
    // You will have to modify the following line to point to your own file
    // String fileName = "C:\\Huhns\\Teaching\\CSCE145\\Code\\Noise3\\preamble.wav";
    FileInputStream fileInputStream = null;
    File file = new File("C:\\Users\\sudharshan_03713\\Desktop\\audio\\1A5.wav");
    // Next, print the sound to find out its length in samples
    System.out.println(file);
    // The following two methods calls get the value of a sound sample at
    // index 1000 and then set its value to half of the original.
    int index = 1000;
    int value = file.getSampleValueAt(index);
    file.setSampleValueAt(index, value / 2);
    // The following loop sets every sound sample to be twice its original value
    for (int n = 0; n < file.getNumSamples(); n++) {
        value = file.getSampleValueAt(n);
        file.setSampleValueAt(n, value * 2);
    }

    // Listen to the sound
    //sound1.play();
}
}

please help when i run its says

Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - Erroneous sym type: java.io.File.getSampleValueAt
 at Prepro.filterpanitha.main(filterpanitha.java:41)   

i have no idea why its pooping up ...is ther any audio format i need to look in to if so how ...please help

2条回答
等我变得足够好
2楼-- · 2019-03-07 05:43

This exception java.lang.RuntimeException: Uncompilable source code is seen when using an IDE which allows you to run your project/code, even if some classes are not compiled (due to errors in code). I suggest fixing your code and you have zero errors before running your project.

Also, java.io.File never have the method setSampleValueAt(). This is what causes your code to never compile.

查看更多
3楼-- · 2019-03-07 05:43

Your error is in this line

int value = file.getSampleValueAt(index);

File doesn't provide the method getSampleValueAt.

查看更多
登录 后发表回答