java

What are some good Java RDF libraries.

I'm looking for a light weight java library for dealing with RDF data. It needs to be able to parse and write RDF xml data. Also I would like it to support simple querying of an RDF model. SPARQL would be nice but not required and I don't need an inferencing capabilities. I've used Jena, but it's not very light weight. ...

How do I encode arbitrary data to XML using Java 1.4 and SAX?

We use SAX to parse XML because it does not require the entire XML document to be read into memory in order to parse a single value. I read many articles that insisted SAX can only be used to parse/decode XML and not create it. Is this true? ...

How do I send an SMTP Message from Java?

How do I send an SMTP Message from Java? ...

Best server-side framework for heavy AJAX Java application

There are zillions of Java web application frameworks. 95% were designed before the modern era of AJAX/DHTML-based development, and that means these new methods are grafted on rather than designed in. Has any framework been built from the ground up with e.g. GWT + Extjs in mind? If not, which framework has adapted best to the world of...

OSGi Testing

Hi all. Currently, I am working on a new version control system as part of a final year project at University. The idea is to make it highly adaptable and pluggable. We're using the OSGi framework (Equinox implementation) to manage our plug ins. My problem is that I can't find a simple & easy to use method for testing OSGi bundles. Cu...

Java Compilation - Is there a way to tell the compiler to ignore parts of my code?

I maintain a Java Swing application. For backwards compatibility with java 5 (for Apple machines), we maintain two codebases, 1 using features from Java 6, another without those features. The code is largely the same, except for 3-4 classes that uses Java 6 features. I wish to just maintain 1 codebase. Is there a way during compilatio...

In JSTL/JSP, given a java.util.Date, how do I find the next day?

On a JSTL/JSP page, I have a java.util.Date object from my application. I need to find the day after the day specified by that object. I can use <jsp:scriptlet> to drop into Java and use java.util.Calendar to do the necessary calculations, but this feels clumsy and inelegant to me. Is there some way to use JSP or JSTL tags to achieve th...

What is the best way to handle photo uploads?

I'm doing a website for a family member's wedding. A feature they requested was a photo section where all the guests could go after the wedding and upload their snaps. I said this was a stellar idea and I went off to build it. Well there's just the one problem: logistics. Upload speeds are slow and photos from modern cameras are huge (2...

Is it possible to use Jackpot outside of netbeans, without netbeans projects?

I know there is a Jackpot API http://jackpot.netbeans.org/docs/org-netbeans-modules-jackpot/overview-summary.html for programmatic access the the rules engine, has anyone had success seperating this from netbeans itself? So it can operate on any java source files? ...

Java: Date.getTime() not including time?

Can't understand why the following takes place: String date = "06-04-2007 07:05"; SimpleDateFormat fmt = new SimpleDateFormat("MM-dd-yyyy HH:mm"); Date myDate = fmt.parse(date); System.out.println(myDate); //Mon Jun 04 07:05:00 EDT 2007 long timestamp = myDate.getTime(); System.out.println(timestamp); //1180955100000 -- where are the...

Modify an xml files in a jar file with Java

I currently am tasked with updating an XML file (persistance.xml) within a jar at a customers site. I can of course unjar the file, update the xml, then rejar the file for redeployment. I would like to kind these command line operations in a Swing App so that the person doing it does not have to drop to the command line. Any thoughts ...

How to do I check CPU and Memory Usage in Java?

I need to check CPU and memory usage for the server in java, anyone know how it could be done? ...

Is there a platform independent way (Java?) to read an audio CD's TOC?

I would like to avoid using native libaries if at all possible. Surely there is a better way to solve this issue for Linux, Windows and Mac OS X. ...

What causes a velocity Template.merge() failure? How does one avoid it?

Hello, Our team has been experiencing a recurring problem with velocity templates. Upon rendering, some throw a RuntimeException with the message "Template.merge() failure - Unable to render Velocity Template, '/template.vm'". We have not been able to reproduce the problem and the documentation on the web is pretty insufficient. The pro...

How do I add a namespace reference to a SOAP response with Apache Axis2 and WSDL2Java

I'm looking at the SOAP output from a web service I'm developing, and I noticed something curious: <soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"&gt; <soapenv:Body> <ns1:CreateEntityTypesResponse xmlns:ns1="http://somedomain.com/wsinterface"&gt; <newKeys> <value>1234</value> ...

Detecting concurrent modifications?

In a multi-threaded application I'm working on, we occassionally see ConcurrentModificationExceptions on our Lists (which are mostly ArrayList, sometimes Vectors). But there are other times when I think concurrent modifications are happening because iterating through the collection appears to be missing items, but no exceptions are thro...

Best Java book you have read so far

Which Java book do you think is the must-have one for all Java developers? Keep in mind: One book per answer Check for duplicates before adding new answers ...

Is there a working on-the-fly compilation in NetBeans 6.5 and how well is it doing?

I learned today that NetBeans 6.5 should have an on-the-fly compilation of (single) Java files. This feature is well known from Eclipse: Simply store the file and the compiled class is stored, too. Is NetBeans working the same way? If not, how is it ticking? ...

Create instance of generic type in Java?

Is it possible to create an instance of a generic type in Java? I'm thinking based on what I've seen that the answer is "no" (due to type erasure), but I'd be interested if anyone can see something I'm missing: class SomeContainer<E> { E createContents() { return what??? } } EDIT: It turns out that Super Type Token...

How can I detect when an Exception's been thrown globally in Java?

How can I detect when an Exception has been thrown anywhere in my application? I'm try to auto-magically send myself an email whenever an exception is thrown anywhere in my Java Desktop Application. I figure this way I can be more proactive. I know I could just explicitly log and notify myself whenever an exception occurs, but I'd hav...