无法编译的源代码 - 错误的符号类型:java.io.File.getSampleV
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16767950/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Uncompilable source code - Erroneous sym type: java.io.File.getSampleV
提问by Panitha Dangalle
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
我不知道为什么它会出现......是否有任何音频格式我需要查看如果有的话......请帮忙
回答by Buhake Sindi
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.
java.lang.RuntimeException: Uncompilable source code
使用允许您运行项目/代码的 IDE 时会出现此异常,即使某些类未编译(由于代码错误)。我建议在运行项目之前修复您的代码并且您的错误为零。
Also, java.io.File
never have the method setSampleValueAt()
. This is what causes your code to never compile.
另外,java.io.File
永远不要有方法setSampleValueAt()
。这就是导致您的代码永远无法编译的原因。