java

Date Util in java that will explode date range in weeks,month,quarter,year

I am looking for a java library that when given from and to date would return a list of dates in weeks,months,quarter or year which ever is most applicable. I have done this manually and i wanted to know if this is already implemented and tested as a part of a standard package. Example Given 1/1/2009 , 1/4/2009 it should give 1/1/2009...

swing text editor that color and highlight.

hi, i am writing an application that the user need to writes a javascript script as an input, right now i have a simple JTextArea but i would like to change it with something that will do some highlights and code coloring to make the script more coherent. do you know any open source thing that does that? thanks ...

How does Java efficiently search jar files for classes?

Suppose I have 500 jar files linked to my program totaling over 500 MB (size of all the jars, not each one) and my program makes a call to a class located in one of them. How does Java search through jars for a class, and what is the efficiency of this? O(n)? O(log(n))? ...

Embed Firefox browser in Java Swing

I am wondering if it is possible to embed Firefox browser as a component in a Java Swing based application. I have done a bit of research from the Internet, but I could not find an answer. Some people suggest to use other browser component avaiable in Java. I do not think that is preferable, as the rendering engine would be different to...

device not found

I downloaded and installed a fat-jar eclipse plug-in to be able to package my project containing an external library(JMF). But when I run the application, it says "No device found". Does this mean that jmf.jar wasn't included in the new jar file since it can't detect the webcam? Because when I'm running the application in eclipse, there ...

What tools exist in Java that are equivalent to svcutil.exe for .NET?

What tools exist in Java that are equivalent to svcutil.exe for .NET? ...

How to let Clients know about new HostedRoom in Smack?

I am working with Openfire and Smack, currently creating new system MultiUserChat rooms. How I tell clients that new system room had been created(deleted) on the server? (I need clients to modify their's Rosters) ...

When and why JPA entities should implement Serializable interface?

The question is in the title. Below I just described some of my thoughts and findings. When I had very simple domain model (3 tables without any relations) all my entities did NOT implement Serializable. But when domain model became more complex I got RuntimeException which said that one of my entities didn't implement Serializable. I...

Is Thread.interrupt() evil?

A teammate made the following claim: "Thread.interrupt() is inherently broken, and should (almost) never be used". I am trying to understand why this is the case. Is it a known best practice never to use Thread.inerrupt()? Can you provide evidence why it is broken / buggie, and should not be used for writing robust multithreaded code? ...

Why does this code throw a java.lang.NullPointerException?

I have found a source code and i added it to my frame just for testing which it uses Java2D. But it thows an exception. I don't understand why. my class: package ClientGUI; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Image; import java.awt.MediaTracker; import java.awt.RenderingH...

Testable Java Code: using model beans with a constructor

According to Misko Hevery that has a testability blog. Developers should avoid 'holder', 'context', and 'kitchen sink' objects (these take all sorts of other objects and are a grab bag of collaborators). Pass in the specific object you need as a parameter, instead of a holder of that object. In the example blow, is this code smell? Sh...

PDFLib opinions/experiences

My organization is considering PDFlib for dynamically creating PDF files (http://www.pdflib.com/) in our Java (Spring/Tomcat) environment. Does anyone have experiences that they can share about the pro/cons of this Library? ...

Java (ME) library for fixed-length record files

I am looking for a library that can run on Java ME (Foundation Profile 1.1, CDC) and allows me to basically do something along the lines of FILE OF type; in Pascal. Background: I need to have a largish (approx. 100MB) set of around 500.000 records for lookups by a known index value quickly. Do I really have to write this myself? Dat...

AddInOrder Best Structure? Java homework

Hi Currently I have a problem where I have a list of IDs, each with a related score. For example: ID : SCORE 1 : 12 2 : 15 3 : 2 4 : 99 I want to loop over these and add them to a structure in decending order of score. So the output will look something like {4,2,1,3} What is the best way of doing this in Java? A queue? Thanks ...

Multiple jboss hosting a domain and SSL

i have a need to have 2 jboss instances (horizontally clustered) both allowing SSL for the same domain. we were trying to figure out how to use one certificate to achieve this. is it possible to let each host have a keystore, and import the same SSL cert into each keystore? is that how it should be done? in the past our network team has...

Is this considered reflection and to what degree?

I have an Android application (java) that was working fine when compiled with the Android 1.6 SDK using the following code from the android.provider.Contacts class: Uri baseUri = Contacts.Phones.CONTENT_FILTER_URL; When the 2.0 SDK came out, the android.provider.Contacts class was depreciated and replaced with android.provider.Contact...

Control the classpath ordering of jars in WEB-INF/lib on Tomcat 5?

I have a legacy web app running in Tomcat 5.0. This web app has two jars in WEB-INF/lib, let's say Foo-2.0.jar and Bar-2.0.jar. Bar-2.0.jar actually includes a Foo-1.0.jar inside of it. Bar is also a dead project, meaning no upgrading, no source, but still important to the application. The latest release of this application requires Fo...

How does a CA decide if entity is trustworthy

Hello, I am currently programming a Certification Authority for a uni class, I am currently struggling with the concept of creating the certificates. How does a CA usually decide if it should give a Certificate to an entity , is it enough to prove that the entity is the owner of a public key by signing a certificate-request with their ...

How to register a QueryExecuterFactory in jasper reports in java

Hi, I implemented JRQueryExecuter and want to use it in a report. Using iReport I managed to register and use the executer. Now I want to use it in a java application, but I can't find any resources how to register the factory. I thought it's enough to have the implementation in the classpath, but I get the following exception: Caus...

Start coding in Java with NetBeans

There is a lot of information about Java around, but I don't understand how to setup everything. I have a Mac. I heard the JDK comes with Macs. But is it the latest? How do I check that? Is it the J2SE or J2EE? I want to create a web app. I installed NetBeans. When I choose create project there is a list of Java options. There is Java/...