There are many questions about it, no answers are working in my application 🙁 I need to remove SMS from a receiver, even if the user can see it, but it must be removed programmatically. How can I do it? The most suitable I have used was the following, but it doesn’t work 🙁 Answer After refactoring my co…
How can I efficiently parse HTML with Java?
I do a lot of HTML parsing in my line of work. Up until now, I was using the HtmlUnit headless browser for parsing and browser automation. Now, I want to separate both the tasks. I want to use a light HTML parser because it takes much time in HtmlUnit to first load a page, then get the source and
Is there a command line option for setting the default log level in Java
Can I do something along the lines of: Obviously that doesn’t work, but you get the idea. Is there anything like that? Or am I forced to create a properties file? Answer You can even pass your log Level as a user defined property. In your code: But I have the idea that your are looking for a more “…
Java: recommended solution for deep cloning/copying an instance
I’m wondering if there is a recommended way of doing deep clone/copy of instance in java. I have 3 solutions in mind, but I can have miss some, and I’d like to have your opinion edit: include Bohzo propositon and refine question: it’s more about deep cloning than shallow cloning. Do it yours…
Get size of folder or file
How can I retrieve size of folder or file in Java? Answer This returns the length of the file in bytes or 0 if the file does not exist. There is no built-in way to get the size of a folder, you are going to have to walk the directory tree recursively (using the listFiles() method of a file object
Import PEM into Java Key Store
I am trying to connect to an SSL server which requires me to authenticate myself. In order to use SSL over Apache MINA I need a suitable JKS file. However, I have only been given a .PEM file. How would I go about creating a JKS file from a PEM file? Answer First, convert your certificate in a DER format
Java date format – including additional characters
Is there an equivalent to php date() style formatting in Java? I mean, in php I can backslash-escape characters to have them treated literally. I.e. yyyy year would become 2010 year. I did not find anything similar in Java, all examples deal only with built-in date formats. In particular, I deal with JCalenda…
How do I get “Goodbye Window” to show up in Java?
I have a Java network application and this is what I want to do: After user logs out, his interface window closes. Now, I want for another window to show up that will say something like: “Thank you for using our application”. This final window should be borderless and without any available option,…
Why are filenames in Java the same as the public class name? [closed]
Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 8 years ago. Improve this question In Java, the name of the file should be the same as the name of the p…
Java heap terminology: young, old and permanent generations?
I’m trying to understand What the concepts of young, old and permanent generations are in the Java heap terminology, and more specifically the interactions between the three generations. My questions are: What is the young generation? What is the old generation? What is the permanent generation? How doe…