java

I need to perform a task when the Quartz scheduler is shutting down.

Hi All, I have a requirement in which I have to do a certain database relted activity when my Quartz will be shut down. I mean I have to wipe out a certain data from the database when I shutdown the scheduler. Is there any way I can achieve this? While googling I came across methods to determine the present state of the scheduler. B...

Exception Driven Programming in Java

I just finished reading Exception Driven Programming and I'm wondering about something like ELMAH for Java. Did you know it? Interesting features: A web page to remotely view the entire log of recoded exceptions A web page to remotely view the full details of any one logged exception An e-mail notification of each error at the time it...

webservice: error in code or connection

Hi, I have a problem in my code or connection I think... I tried to connect to a MySQL database and web service, but when I run the program, it gives me the following error: @WebService() public class LostNumWebService { /** * Web service operation */ @WebMethod(operationName = "getCategory") public List getCategory(@WebPar...

Trying to play music in Java ME, but I get an Exception "Incompatible Types"

I need to play music (this is the only sound in my game). So far I've written this, but it keeps giving me errors: "incompatible types" Here's my sound code: try { InputStream is = getClass().getResourceAsStream("/sound.wav"); Player p = Manager.createPlayer(is, "/X-wav"); p.start(); } catch (IOException ioe) { } catch (...

Postgres + Hibernate + Java UUID

I want to use PostgreSQL's native UUID type with a Java UUID. I am using Hibernate as my JPA provider and ORM. If I try to save it directly, it is just saved as a bytea in Postgres. How can I do this? ...

Why does this code compile and run successfully it seems it should get an index out of bounds.

I was reading through some java code in a project I was working on and came along a method with something to this effect in it. Object[] objs = null; objs[0] = str1; objs[1] = obj1; for(String str: strArray) { objs[objs.length+1] = str; } I can't figure out what is going on here. I was hoping someone could explain how this code i...

how do you make getResourceAsStream work while debugging Java in Eclipse?

This is mind-boggling... I can make getResource() and getResourceAsStream() work properly when I run Java on my packaged JAR file that includes a text file. (for reference see the Sun docs on accessing resources) I can't seem to make the same program work properly when I am running it within Eclipse, even though I've placed my text file ...

getBytes vs getBinaryStream vs getBlob for getting data out of a BLOB column

There are 3 different ways to get data out of a Blob column: getBytes getBinaryStream getBlob Also, the Blob object returned by getBlob also has a getBytes and getBinaryStream on it. Are there any particular reasons (performance, memory, database specific problems) that I should pick one over the other? The Blob object also has a fre...

Hibernate Search for multiple classes

There are two tables with no relation defined eg : Bugs and Comments For each bug id there are multiple comments.Suppose I am using a query like select b.bugid,b.bugtitle,c.comment from bugs b , comments c where b.bugid = c.bugid In hibernate search ,is there any method to write text queries for multifield searches ? In case, for a...

Selection Path of a JTree

I've loaded a JTree with nodes from an XML Schema file using the XSOM API (https://xsom.dev.java.net). Every time a file is selected I do the folowing: schemaParser = new XSDParser(selectedFile.getAbsolutePath()); TreeModel model = schemaParser.generateTreeModel(); schemaTree.setModel(model); schemaTree.setCellRenderer(new SchemaTreeT...

HTMLDocument: does Swing "optimize out" span elements?

I'm messing about with HTMLDocument in a JTextPane in Swing. If I have this situation: <html>... <p id='paragraph1'><span>something</span></p> <span id='span1'><span>something else</span></span> ...</html> (the extra <span> tags are to prevent Swing from complaining that I can't change the innerHTML of a leaf) or this situ...

suggestions for declarative GUI programming in Java

I wonder if there are any suggestions for declarative GUI programming in Java. (I abhor visual-based GUI creator/editor software, but am getting a little tired of manually instantiating JPanels and Boxes and JLabels and JLists etc.) That's my overall question, but I have two specific questions for approaches I'm thinking of taking: Ja...

[Java] JDO - Updating an Object

Hi, i am experimenting with the Google App Engine, and the persist option JDO. I would like to know if it is possible to map a transient object to a persist object? Or something to update the persistent object with the use of an transient object? I the coding examples i see the following piece of code to update objects: public void u...

[Java] Boxlayout can't be shared error

I have this Java JFrame class, in which I want to use a boxlayout, but I get an error saying "java.awt.AWTError: BoxLayout can't be shared". I've seen others with this problem, but they solved it by creating the boxlayout on the contentpane, but that is what I'm doing here. Here's my code: class edit_dialog extends javax.swing.JFrame{ ...

Easy to learn 3D IDE for Java

Hi, I need create a 3D model of and animate a robotic arm. The arm is going to receive inputs on how to move via serial I/O. What is the best Java IDE for me to create this 3D model with? It doesn't have to be fancy or anything, just a proof of concept. Unfortunately, I haven't had any experience with animation before, so I'd apprec...

Is there anything like ELMAH for Java?

Duplicate: Exception Driven Programming in Java I have been looking at ELMAH and was wondering what kinds of similar applications are available for Java. Thanks for the recommendations for log4j and other frameworks. Like the author of the post this question duplicates, I'm just looking to see if a more full-featured solution exists ...

Multiple animated JPanels - only last one added to JFrame is displaying?

Hi, I am making a multithreaded pacman game. There is a PacmanController class which extends JFrame, a Maze class which extends JPanel, a Pacman class which runs in its own thread and extends JPanel, and a Ghost class which runs in its own thread and extends JPanel. Each thread (pacman and each Ghost) continuously repaints itself and ...

Fastest way to compare two data structures in java

Hi, I would like to know what is the fastest way in java 1.5 to compare two data structures. My data structure represents a tree that can be pretty big. I can traverse the whole data structure and compare the 2 node by node (which I guess will be slow). Or I can compute a hash of the data structure to do it faster, right ? What is the...

How much of the Java SE api is written in Java?

How much of the Java SE api is actually written in Java itself? ...

What does CMS mean in relation to Java's Garbage Collector?

A lot of JVM's command line arguments dealing with the garbage collector have "CMS" prepended to them. What does this stand for? ...