java

Browser Java Plugin Detection

What is the preferred method to determine if the Sun Java Plugin is installed in the browser? ...

Get term frequencies in Lucene

Is there a fast and easy way of getting term frequencies from a Lucene index, without doing it through the TermVectorFrequencies class, since that takes an awful lot of time for large collections? What I mean is, is there something like TermEnum which has not just the document frequency but term frequency as well? UPDATE: Using TermDoc...

Display CMD output in my GUI (java)

How might I get the output from a CMD process to display in my GUI? This is the code I'm using to run the process: try { String line; Process p = Runtime.getRuntime().exec("cmd /c \"e:\\folder\\someCommands.cmd\""); BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream())); while (...

Can you Unit Test Obfuscated Code?

I am looking to obfuscate our Java web app code within our existing Ant build script, but am running into problems around unit testing. I am obfuscating the code right after it has been compiled, before it is jar-ed and before the unit tests are ran. However, if I obfuscate my production code and not my test code, all my tests fail b...

Java Socket : TCP Checksum Incorrect

I'm experimenting w/java sockets. I can connect to a socket and send/receive bytes of data w/o a problem. However I am also sniffing the traffic using wireshark and noticing each packet that comes from the java socket is marked by wireshark as "tcp checksum incorrect." Anyone have any insight? java version "1.6.0_12" Java(TM) SE Runtim...

Is there a selenium API call to check if somethingIsSelected in a MultiSelectField??

I am aware that there is a selenium API (isSomethingSelected) used to see if a value is selected in single-select dropdown. Is there an equivalent for multiselect? ...

How can I build a list of days, months, years from a calendar object in Java?

I want to build a date widget for a form, which has a select list of months, days, years. since the list is different based on the month and year, i cant hard code it to 31 days. (e.g february has 28 days not 30 or 31 and some years even 29 days) How can I use the calendar or joda object to build me these lists. ...

Jasmin in CLASSPATH

I have download jasmin.jar from http://sourceforge.net/project/showfiles.php?group_id=100746 I have changed my CLASSPATH to the following: echo %CLASSPATH% C:\Program Files\Java\jre6\lib\ext\QTJava.zip;C:\Sun\SDK\lib;C:\Sun\SDK\jdk\lib\jasmin\jasmin.jar; The following command works without a problem: java -jar C:\Sun\SDK\jdk\lib\ja...

Why is my import not working in Java?

I have a Java assignment that uses components to build program. The teacher gave us a JAR we are to use to build the calculator using Eclipse. The JAR has 2 classes. We must import the JAR and use its classes. I import the JAR: import SWEB401_HW1.NumericOperation; but when I try to create an object for the class, it gives me an err...

MVC and Java in comparison with more strict MVC languages

I've been told Java is not the greatest pick to follow an MVC architecture. I believe I've seen some Java framework solutions to ease this roadbump. However, I a bit confused on why this is. More specifically, why Java's attempt at MVC is often mocked as a "wannabe" approach. I come from a ObjC background (w/ Cocoa of course) and would l...

Would you consider Terracotta to be a mature product?

I just don't know. I mean, there are a few topics that point me away from believing such. For example, the latest stable version (3.0.0-stable), has a broken eclipse plugin that simply doesn't work at all. Furthermore, attempting to upgrade between revisions is an enormous hassle, as all servers are incompatible with all clients not of ...

playing wav file in java - how do I extend or concatenate the sound played?

Is it possible to create a temporary file that contains a "loop" of a wav file? Or is it possible to manipulate the stream sent to a stream reader/writer? Basically I want to play some wav file for a period of time and if that time is greater than the length of time that the wav file provides I want to loop. ...

display series of images with next button

How can I display a series of images one by one every time the user clicks the next button? I have few images stored in array. I used button next to go from image to image. How to programme the button? I used action listener but I just don't know how to get back to the array. ...

Android java.lang.VerifyError?

In my Android app, I always get VerifyErrors! And I cannot figure out why. Whenever I include a external JAR, I always get VerifyErrors when I try to launch my app (except for once, when I included Apache Log4j.) I usually get around this by taking the source of the library and adding it to my project, but I am trying to put the GData cl...

Objects of session and request

In struts, where does the session object created & which class or method creates it? Likewise where does the request object created & which class or method invokes it? Thanks in advance ...

JSF 1.2 Custom Component - Body Content From Backing Bean

Hi I am developing a custom component using JSF 1.2 . My tag class extends UIComponentELTag and has variables of data type ValueExpression. The values for these are getting set from the corresponding attributes of the tag. (Using setProperties function) Example, <sr:show name="#{backingBean.name}" ...> #{backingBean.mainContent}</sr:...

Clearest way to comma-delimit a list (Java)?

Using a comma is just to make it specific - it could be any delimiter, so using List's default toString() doesn't help. (The question could be rephrased as: "best way to implement List's toString?") This is a well-known problem, and I know several ways of doing it, but I'm wondering what the best way is (where "best" means clearest and...

Java embedded applet page security, how to properly meet its recquirements?

If I have an applet embedded in a webpage and I want it to connect to server side software (also written in Java) how can I do this properly on a windows machine running local host? Would I have to run the java application from within the localhost directory and access the applet html from a browser (i.e. localhost/applet.html)? From wh...

GoogleMaps API in Java

Hi! Is there a good performant way to use GoogleMaps in Java Projects without using i.e. a SWT Browser. I just know of the SwingX Toolkit (swinglabs.org) which has a quite good implementation, but it can only use OpenMaps (not the same functionality as GoogleMaps) or the Nasa BlueMarble. thanks in advance Lukas ...

Synchronizing on shared data structure

Consider code that involves multiple threads writing to a shared data structure. Now each of these threads write objects to the shared container that are essentially unique. Take the following (fictitious) example: class Logger { IDictionary<string, Log> logDictionary = new Dictionary<string, Log>(); // Method called by several o...