I am having diffuculties while trying to make the path of my files relative.
I am using an interface to hold my static variables in order not to mix them with my other codes , just implementing the interface is sufficient to use the variables.
I need to give the address of my file as a parameter, and i am making it by using absolute path of file just like below .
>>static JLayerPlayer xLayer=new JLayerPlayer("C :/Java_Projects/Ney1/src/Sounds/plainSounds/xFile.mp3");
But i need to make them relative paths. When i try the code below.
>>static JLayerPlayer xLayer =new JLayerPlayer(ge tClass().getRes ource("/Sounds/plainSounds/xFile.mp3"));
I am getting an error says you can not use non-static getClass() method inside a static class or in interfaces, is there any other way to accomplish relative path inside interfaces.
Thanks in advance.
I am using an interface to hold my static variables in order not to mix them with my other codes , just implementing the interface is sufficient to use the variables.
I need to give the address of my file as a parameter, and i am making it by using absolute path of file just like below .
>>static JLayerPlayer xLayer=new JLayerPlayer("C :/Java_Projects/Ney1/src/Sounds/plainSounds/xFile.mp3");
But i need to make them relative paths. When i try the code below.
>>static JLayerPlayer xLayer =new JLayerPlayer(ge tClass().getRes ource("/Sounds/plainSounds/xFile.mp3"));
I am getting an error says you can not use non-static getClass() method inside a static class or in interfaces, is there any other way to accomplish relative path inside interfaces.
Thanks in advance.
Comment