java

How do I make other classes derive from a singleton class ?

I am sorry if this is a duplicate or too elementary, but how do I make a singleton class that can be subclassed? ...

How should i use a jar file ?

I have a jar file which contains some classes those which i want to use in my project. I am working in command line and not in eclipse. Please tell me how i should use those classes in the jar file for my project. ...

Java NIO FileChannel versus FileOutputstream performance / usefulness

Hello, I am trying to figure out if there is any difference in performance (or advantages) when we use nio FileChannel versus normal FileInputStream/FileOuputStream to read and write files to filesystem. I observed that on my machine both perform at the same level, also many times the FileChannel way is slower. Can I please know more de...

How to read XML Property value using Java

Hi all, I need to read XML data by using java. This is my XML file snippet. <?xml version='1.0' encoding='utf-8'?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"&gt; <hibernate-configuration> <session-factory> <!--...

Java Gridgain application starts to fail after 1 day of stress testing

So I have a an application which is running on top of gridgain and does so quite successfully for about 12-24 hours of stress testing before it starts to act funny. After this period of time the application will suddenly start replying to all queries with the exception java.nio.channels.ClosedByInterruptException (full stack trace is at ...

How to create and read a sequence in Hibernate?

Hello, I need to use a sequence to get a unique value. The production code uses postgres but I would like to access it via Hibernate so that I can test this with HSQLDB. How can I create and read a sequence in Hibernate? ...

Axis2 implementing client side

I need to create connection to web service with axis2. I would like to know how can I convert recieved xmls to Java objects. Is there any good tutorials to learn how to do this? ...

Spring JSON View: ApplicationObjectSupport does not run in an ApplicationContext

I'm trying to use a Json View for Spring (http://spring-json.sourceforge.net/) (org.springframework.web.servlet.view.json.JsonView) but whenever I write a controller class that extends AbstractController I get the following Error: java.lang.IllegalStateException: ApplicationObjectSupport instance [org.springframework.web.servlet.view.js...

How can I know if a Class is mapped as a Hibernate entity?

I have an Object. How can I know if its class is mapped to a table in Hibernate? ...

Executing a method from another class in Java... and more

Hiya all, I have a method that returns a list of items called findItemByPIdEndDate() and its found inside MngtImpl.java class. Now I'd like to execute this method every once in a while, hourly lets say so here is what I did so far : This is CronSchedule.java import org.quartz.CronTrigger; import org.quartz.Scheduler; import org.quartz...

PropertyChangeSupport and equals method

I'll try to explain my problem as clear as possible :). I am using PropertyChangeSupport to notify registered views for changes in the properties. One of the property is an object which properties are changed every view seconds. I don't want to create for this particular object new instance every time it is being updated (for the propert...

Error using jaxb external bindings customization

I use the wsdlc tool (weblogic 10.3.1) to generate classes from wsdl. I have the following external jaxb bindings customization file: <jaxb:bindings xmlns="http://java.sun.com/xml/ns/jaxb" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-...

Obtain nameserver information for DNS lookups in Java

Hi everyone, If I look up a IP address from a DNS name as follows: InetAddress inetAddress = InetAddress.getByName(name); String address = inetAddress.getHostAddress(); Can I find out which nameserver gave me the information? ...

Multi-platform multi-module builds with Maven

I have a large project which uses SWT on several different platforms like windows (32 and 64 bits), linux-gtk (32 and 64 bits) etc. The project has several modules in a simple structure: project-parent +- core +- swt-bridge (uses SWT) +- module1 (uses swt-bridge module) +- module2 +- ... +- module17 (uses swt-bridge module) I w...

data type to represent a big decimal in java

Which data type is apt to represent a decimal number like "10364055.81". If tried using double: double d = 10364055.81; But when I try to print the number, its displaying as "1.036405581E7", which I don't want. Should I use BigDecimal? But its displaying as 10364055.81000000052154064178466796875. Is there any datatype that displays ...

Look-and-feel of an applet window changes on subsequent displays

I have an applet that displays a dialog box on click of a button. When the dialog box is first displayed, it is shown using the native look-and-feel of the OS. When the dialog box is displayed a second time (same page, browser, OS, etc.), it is shown using what I think is the Swing look-and-feel. To my knowledege, I do not explicity s...

Unable to create file in C:\TEMP

Following on from a previous question, for some reason when I use the following code : final File tmpDir = new File("C:/TEMP/", zipFile.getName()); if(!tmpDir.mkdir() && tmpDir.exists()) { System.err.println("Cannot create: " + tmpDir); System.exit(0); } I get an error (Cannot create: C:\TEMP\aZipFile) how...

GUI tool for configuring Java property files and XML files

Hi, This is more of a question about tools that are out there instead of a programming question on one particular stuff. So apologies in advance if the question does not belong here. I have an application that I want to develop a GUI configuration tool for. At the moment config files for the application are found in a couple of directo...

generating javadoc as a word document

How can we generate javadoc as a word document instead of the traditional html pages? ...

Why is catch block executed twice for a single exception ?

Hi, I have the following code. try{ Twitter twitter = new Twitter(user,password); twitter.setStatus(txtStatus.getText()); JOptionPane.showMessageDialog(null, "Success"); txtStatus.setText(""); txtStatus.requestFocus(); }catch(Exception e){ JOptionPane.showMessageDialog(null, "Some Error.\n" + " If you ...