Skip to content

Tag: java

How to create a file in a directory in java?

If I want to create a file in C:/a/b/test.txt, can I do something like: Also, I want to use FileOutputStream to create the file. So how would I do it? For some reason the file doesn’t get created in the right directory. Answer The best way to do it is:

Java – Forward Slash Escape Character

Can anybody tell me how I use a forward slash escape character in Java. I know backward slash is but I’ve tried / and / / with no luck! Here is my code:- Thanks in advance! Answer You don’t need to escape forward slashes either in Java as a language or in regular expressions. Also note that

How to find root of memory leaks?

My app is basicly and image editor. There is a welcome page which opens main activity with an intent. If orientation changes when main activity is working the memory consumption simply doubles up and remains that way. If i close the main activity turn back to welcome activity and start main activity again sam…

Playing .mp3 and .wav in Java?

How can I play an .mp3 and a .wav file in my Java application? I am using Swing. I tried looking on the internet, for something like this example: But, this will only play .wav files. The same with: http://www.javaworld.com/javaworld/javatips/jw-javatip24.html I want to be able to play both .mp3 files and .wa…