java

Java identifier resolution rules

What search order does the Java compiler use to resolve Foo in the following class? class Test { Foo f; } Empirical tests reveal the following search order: Nested classes Superclass nested classes java.lang.* classes Others? but I'd like to know where this is discussed in the Java Language Specification. ...

Available Servlet 3.0 implementations?

Which implementations of the Servlet 3.0 specification are available (or at least in beta) besides GlassFish? ...

Transaction error while updating data

Following error occurs while updating a particular data in my web application.I am using HibernateTransactionManager to manage all transactions in the application. Error:- Pre-bound JDBC Connection found! HibernateTransactionManager does not support running within DataSourceTransactionManager if told to manage the DataSource...

In Java, what event is *continuously* fired on mouse button down?

Hi all. I would like to know if there exists in Java an event that is continuously fired when a mouse button is being held down (pressed), even if the mouse is not moved. I could not find it in typical MouseListeners: MouseDragged is fired only if the user move the mouse while holding the button down MousePressed is fired only once wh...

How to add custom VariableResolver to JSP Context in Jsp 2.0 to support special EL?

I'm building my own JSP Tag Library which need to support some features that Application developers can use like this: <w:user-label id="usrlb" value="${session.user}"/> <w:textbox id="tb" label="User Name" value="${usrlb.value.name}"/> which means I want my EL can interact with my Tag declaration. and also I need to add stack concept...

EJBQL date comparison

Hi; In EJBQL how can compare two date values; suppose "Select e from Employee e where e.start_date > :start_date" If I set query parameter with setParameter("start_date", new Date()); An Exception occurs on running.. I wait for your suggestions ...

Losing Class Custom Annotation For Proxy Classes

Hi, I am using Seam to inject beans to my controller using @In annotation. The injected class has a custom annotation, when calling injectedClass.getClass().getAnnotation(annotationClass) it returns null. When debug I found that Seam passes a proxy instance so getClass() returns InjectedClass_$$_javassist_seam_5 which doesn't have my c...

The line-height css property does not work in a JEditorPane. Can anyone help?

When I place the following html in a JEditorPane, the line-height attr is not obeyed (the font and color ones are though). Does anyone know what I am doing wrong? I checked the html in firefox and it's fine. <html> <head> <style type="text/css"> p { color:#222222; line-height: 200%; font-family:Tah...

Adding calendar entries programmatically in the local environment ie. for Outlook

Hi, I'm looking for a way to add or delete events that can be viewed through outlook on the same machine that my program is running. I'm looking for a low pain / low setup solution, and will be accessing this through java. - Just to ellaborate on that last point, it should be completely local, with no reliance on a network being accessib...

Converting an array of long to ArrayList<Long>

This sadly doesn't work: long[] longs = new long[]{1L}; ArrayList<Long> longArray = new ArrayList<Long>(longs); Is there a nicer way except adding them manually? ...

Read escaped quote as escaped quote from xml

Hello. I load xml file into DOM model and analyze it. The code for that is: public class MyTest { public static void main(String[] args) { Document doc = XMLUtils.fileToDom("MyTest.xml");//Loads xml data to DOM Element rootElement = doc.getDocumentElement(); NodeList nodes = rootElement.getChildNodes(); Node chi...

Volume Control in Processing (java)?

hi, I'm working on a Processing project. I tried to set the Volume of the audio played with the minim library. (setVolume seems not to be supported, and setGain has no effect) So, I'm wondering whether there is no other, simpler way to control the audio in Processing? Or are there some Java commands, that can be used directly? (In fa...

How to draw a JPanel on a canvas?

Hi, is there a possibility to draw a JPanel on a specific location op a Graphics (or Graphics2D) object? I override the paint method of my canvas, and call panel.paint(g) in there, but it does not work the way I woul hope. @Override public void paint(Graphics g){ Dimension size = panel.getPreferredSize(); panel.setBounds(pos.x, pos...

Google Collections equivalent to Apache Commons Collections ArrayUtils.toObject and ArrayUtils.toPrimitive

Since everyone praises Google Collections (e.g. in here) How come I can't find the equivalent of ArrayUtils.toObject() and ArrayUtils.toPrimitive()? is it that unusable? did I miss it? ...

Maven dependency for Servlet 3.0 API?

How can I tell Maven 2 to load the Servlet 3.0 API? I tried: <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> <version>3.0</version> <scope>provided</scope> </dependency> I use http://repository.jboss.com/maven2/ but what repository would be correct? Addendum: It works with a depend...

java gui without desktop environment

Is it possible to use java gui frameworks (such as Swing, SWT or javaFX) without desktop environment, such as Gnome? ...

clustering and loadbalancing through J2EE

I want to develop clustering and load balancing by using j2EE,I want to use two Tomcats in back-end,If any request arrives to my application it should send request to the tomcats based on the load factor.I want to add fail over and session replication to my application. Please suggest.. The API for load balncing and clustering that i h...

JNA - DsGetDcNameA

Hi, I am new to JNA, I want to convert DsGetDcName method to JNA. DWORD DsGetDcName( __in LPCTSTR ComputerName, __in LPCTSTR DomainName, __in GUID *DomainGuid, __in LPCTSTR SiteName, __in ULONG Flags, __out PDOMAIN_CONTROLLER_INFO *DomainControllerInfo ); I have converted the above function to JNA I replaced ab...

What are Dependency Injection & Spring Framework about ?

Possible Duplicates: What is dependency injection? What exactly is Spring for? I want to know What is Spring Framework? Why and when should one use it in Java Enterprise development? The answer would be "A dependency injection framework". All right, what advantages do we have when using dependency injection frameworks? The...

CSS file is not loading?

I am having a JSP file with the below codes <HTML> <head> <link rel="stylesheet" type="text/css" href="../CSS/home.css" /> <link rel="stylesheet" type="text/css" href="../CSS/left.css" /> <script type="text/javascript" src="../js/friend_request.js"></script> </head> <body> <div class="menu"> <form name="search_form" method="p...