Skip to content

Tag: java

java Extracting Zip file

I’m looking for a way to extract Zip file. So far I have tried java.util.zip and org.apache.commons.compress, but both gave a corrupted output. Basically, the input is a ZIP file contain one single .doc file. java.util.zip: Output corrupted. org.apache.commons.compress: Output blank file, but with 2 mb …

Where is Java Installed on Mac OS X?

I just downloaded Java 7u17 on Mac OS 10.7.5 from here and then successfully installed it. In order to do some JNI programming, I need to know where Java installed on my Mac. I thought that inside the /Library/Java/JavaVirtualMachines/ folder, there would be a folder called 1.7.0.jdk or something, but then I …

Print the type name of object held by variable

In Java, is it possible to print the type of value held by variable? One approach to this problem would be to use an if-statement for each variable type, but that would seem redundant, so I’m wondering if there’s a better way to do this: Answer I am assuming that in case of Animal myPet = new Cat(…

compare two numeric String values

I have a simple doubt. Would be great if anyone helps me. I have two strings: Both the values are equal but how to compare them in java? We have equals and equalsIgnoreCase for comparing String alpha values, similarly how to compare numeric values. Answer That is it. You can convert a numeric string into inte…

Download file with original file name

In my project I am uploading a file. While uploading, I am saving its original file name and extension in a database and saving that file with some GUID on server, generated GUID is also stored in database along with file name and extension. For example- -File name for uploading is questions.docx -Then origna…

Android ProGuard settings for Facebook

I finally found out why my app crashes built for release. ProGuard was indeed stripping code from my application but i prevented this by manually adding the classes with the keep command in the proguard-android.txt (found in the sdk). For Facebook I used: But I think I’m still missing something. The app…

How can I get a frame sample (jpeg) from a video (mov)

I want to get a frame sample (jpeg) from a video file (mov) with java. Is there an easy way to do this. When I search in google all I can find is to make mov from multiple jpgs. I dont know maybe I cannot find the right keywords. Answer Xuggler does the job. They even give a sample code