java

In Java, is it possible to know whether a class has already been loaded?

Is it possible to know whether a Java class has been loaded, without attempting to load it? Class.forName attempts to load the class, but I don't want this side effect. Is there another way? (I don't want to override the class loader. I'm looking for a relatively simple method.) ...

With hessian in Java, how do you control instantiation?

I have a cache of objects (not the HTTP session attributes) and I want to be able to get an object from this cache when a Hessian request comes in and have Hessian execute the call on this object instead of the servlet. I can control the class that the request is executed on by setting the service-class and api-class init parameters on...

Java: Specifying generics on Type AND Implementation

Most references I've seen, and my IDE's code completion all have my specifying a Generic type on both a variables type and its implementation eg. List<String> string = new ArrayList<String>(); Recently I've started skipping the generic type on the implementation eg. List<String> strings = new ArrayList(); assuming that the compiler...

converting strings to Title case in JSTL

Hi, Is there any way to convert a string to Title case, using JSTL tags? Thanks in Advance. ...

Why was constness removed from Java and C#?

I know this has been discussed many times, but I am not sure I really understand why Java and C# designers chose to omit this feature from these languages. I am not interested in how I can make workarounds (using interfaces, cloning, or any other alternative), but rather in the rationale behind the decision. From a language design persp...

Access gmail from Java

I need a library that allows me to do email operations(e.g Sent/Receive mail) in Gmail using Java. ...

Where is the content of a java piped stream 'stored' ?

I am running my application under a profiler. The 'class' that has the most memory consumption is the 'char[]' which is about 10kB in my application. I then created an InputStream (PipedInputStream to be exact) which holds a byte array data of 300MB. Then I took a look at my profiler, and I don't see any significant change ( don't see...

Overriding Binding in Guice

I've just started playing with Guice, and a use-case I can think of is that in a test I just want to override a single binding. I think I'd like to use the rest of the production level bindings to ensure everything is setup correctly and to avoid duplication. So imagine I have the following Module public class ProductionModule impleme...

How can I get my basic SWT application to exit properly in Mac OS X 10.5.6?

I have the following SWT test code: public static void main(String[] args) { shell = new Shell(); shell.setText(APP_NAME + " " + APP_VERSION); shell.addShellListener(new ShellListener() { public void shellActivated(ShellEvent event) { } public void shellClosed(ShellEvent event) { exit(); } public void shellDeactivated(...

Creating a custom JAXB annotation

Do people have any recommendations on how i could write my own custom JAXB annotation handling class to support the generation of xs:annotation/xs:documentation elements in the xsd schema?. I'd like to create a new java annotation "@XmlAnnotation" which would include a "documentation" attribute. I'd then make these classes available to t...

Java library that finds sentence boundaries

Does anyone know of a Java library that handles finding sentence boundaries? I'm thinking that it would be a smart StringTokenizer implementation that knows about all of the sentence terminators that languages can use. Here's my experience with BreakIterator: Using the example here: I have the following Japanese: 今日はパソコンを買った。高性能のマックは早...

Memory leak in JBoss

I am having a very strange behavior in JBoss, and I'd like avail myself of the Collective Wisdom of the SO Crowd. We're using JBoss (4.0.4 I think) to serve SOAP calls. In fact, it's used as glorified RPC server, no more. We're running out of memory when we have 20+ clients sending their requests at the same time. The requests consist o...

garbage collection Operation

Hey all, Can someone please explain me how garbage collection is working? (I'm using C# and Java). ...

Eclipse buildpath automatically taking all JARs of a internal directory

How do I configure my project buildpath to have a set of .jar files located in the same directory automatically included in the buildpath ? Meaning that adding a new .jar file to this directory (and refreshing the project) updates the buildpath ? Rem : I am not working in a Webapp but in a standalone Java app. I know that it is possible ...

java.util.zip.ZipException: too many entries in ZIP file

Hello, I am trying to write a Java class to extract a large zip file containing ~74000 XML files. I get the following exception when attempting to unzip it utilizing the java zip library: java.util.zip.ZipException: too many entries in ZIP file Unfortunately due to requirements of the project I can not get the zip broken down before...

Tomcat/IIS closes socket after http response has completed

Hi. I am using JBoss 4.0.4 GA, which has Tomcat Servlet Container 5.5. I also have IIS 6.0 redirected to this JBoss. (via IIS tomcat connector, which is used as ISAPI filter in IIS). All is working OK, configured the workers as described. Here is a piece of workers.properties file of the connector: # # Defining a worker named ajp13 and...

Compare and Contrast Java Module/Plugin mechanisms

There are several mechanisms for module/plugin mechanisms: JSR-277 (now defunct), Project Jigsaw OSGi Eclipse plugins (currently built on top of OSGi) Netbeans plugins Android apps Glassfish plugins (also the lesser used HK2 system) java.util.ServiceLoader ... your favourite ... Inspired by this dZone article, I had hoped that we co...

getting a property of a java bean of unknown class

Hello, I'd like to be able to call "getProgram" on objects which have that method, without knowing which class they belong to. I know I should use an interface here, but I'm working with someone else's code and can't redesign the classes I'm working with. I thought BeanUtils.getProperty might help me, but it seems it only returns strings...

Media analysis java library

Hi, As a "learn Groovy" project, I'm developing a site to manage my media collection (MP3, MP4, AVI, OGG) and I wasn't able to find any open source library to retrieve meta data from this files. I was thinking of something like Linux's file command. I've found few libraries on Java that do one or the other (like mp3info), but not a tota...

DateFormat with no miliseconds

This is probably a simple question but I can't seem to find the solution. I have a time string that is 8 digits long (epoch seconds), when I try to format this using the Java DateFormat, it always assumes that my time contains milliseconds as well, so 16315118 converts to: 4:31:55.118 instead of the correct time of 19:58:38. I do not ...