java

Android java.util.Calendar - Time Difference

I want to make calendar view in order to support touch interaction. So I'd like to build new custom calendar view. I tried to make mapping function between view offset and real date value. Here is my idea: If I can compute the number of weeks since base date(in my case, 1989-12-31), it is easy to know offset. HEIGHT_FOR_WEEK * NUM_OF_W...

JMS bridge in WebSphere 7.0

How can I define a JMS bridge in WebSphere 7.0 application server? ...

Constructing a generic java class where T is a class foo or a subclasses of foo

I have a class Foo with subclass SubFoo, a collection class FooListing. I want to create a generic FooListing<T> where T is either Foo or a subclass of Foo From the wording of the documentation (under 'Wildcards'), it sounds like public class FooListing<T extends Foo> { ... } ...would let me use FooListing<SubFoo>, but not FooListin...

Problem with Java Web service. Unable to create JAXBContext

Dears, I used NetBeans to create a Metro Web service and GlassFish to be deployed on. I get an error when I try to build -but only- if one of the operations in the web service return an Object instead of primitive types or String. the Error is Deploying application in domain failed; Deployment Error -- Exception occured in the wsgen ...

Manipulating Windows file permissions in Java

Using Java how could I manipulate the access permissions of a file in Windows? ...

Java Color creation throws IllegalArgumentException when used with integer arguments

The following code when executed on certain machines in our company causes an IllegalArgumentException to be thrown: Color sludge = new Color(133, 133, 78); //throws IAE with message "Color parameter outside of expected range: Red Green Blue" An equivalent call using float arguments instead works: Color sludge = new Color(0.522, 0.52...

Scalable http session management (java, linux)

Is there a best-practice for scalable http session management? Problem space: Shopping cart kind of use case. User shops around the site, eventually checking out; session must be preserved. Multiple data centers Multiple web servers in each data center Java, linux I know there are tons of ways doing that, and I can always come up wi...

nullpointerexception on request.getHeaderNames method call in websphere

In websphere (version 6 sp11) on request.getHeaderNames method call, i get this exception java.lang.NullPointerException at com.ibm.ws.webcontainer.srt.SRTServletRequest.getHeaderNames(SRTServletRequest.java:345) at .... I dont have source code for SRTServletRequest. Has anybody faced this problem? ...

php java bridge not working on tomcat 6

I just installed the current Tomcat version on my mac because I wanted to try the PHP Java bridge. I followed the guide here http://php-java-bridge.sourceforge.net/pjb/tomcat6.php but when I paste the xml config to the tomcat configuration file <listener><listener-class>php.java.servlet.ContextLoaderListener</listener-class></listener...

How to get local application data folder in Java?

I'm looking for a way to get the location of the local application data folder, which is a special Windows folder, in Java. Unfortunately, the following only works for English versions of Windows XP with default settings: System.getProperty("user.home") + "\\Local Settings\\Application Data" What I'd like to have is something like thi...

Something like EJB wiring in Spring for non EJB's

I've noticed recently that spring can wire up my ejb's for me if I annotate the ejb with @Interceptors(SpringBeanAutowiringInterceptor.class). I've never actually done this so don't know the details. I was wondering, is there a way to get this to work with other kinds of beans, for example, @WebService annotated ones as well. At the mo...

Java Webstart with parameters

Can I launch a Java WebStart application with a set of parameters just like an applet is configured with the <param> tags ? Thanks ...

Converting an Eclipse Java project to a Google AppEngine one

I have a project with a large amount of pre-processing. I have written this part and would now like to convert the project to a GAE project. I have enabled the GAE support in Project->Properties and have some functionality but when I want to testrun the app I get a "Web application archive directory does not exist." Is there a way to ...

Recommend XML Difference open source Java libraries?

I have a requirement to compare two XML documents and report differences. String comparison is not sufficient as I want to be able to say that: <Foo/> is the same as <Foo></Foo> Anyone used a library they would recommend? ...

How to get the id of a bean from inside the bean in Spring?

What is the easiest way to retrieve a bean id from inside that bean (in the Java code) without using a BeanPostProcessor to set a field? The only way I can think of is something like this using a BeanPostProcessor: public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { ((MyBean)bean).set...

using google map after logging

I have a project witch is using googleMap, when I used localhost googleMap works correctly and anythings is OK, but when I deploy it on the other computer the site can not work(don't show google map!!!). I got a valid key but stil this problem exists! please help me! ...

What is the most dangerous feature in Java?

Which feature of the Java-language is the source of the most misunderstandings and bugs in your experience? The scope of this question is about the language, not the class-library. ...

how to redeploy an application on Jboss within Eclipse ?

Hi there, i'm developing a spring-based application with facelets and Java Server Faces which works on Jboss Application Server. As a development Framework, i'm using Eclipse Ganymede Platform Version: 3.4.2 , which integrates the Web Standard Tools and therefore offers support for different servers, like Jboss 5.0. I'm deploying my a...

Read Browser/Client time from Http Servlet request header

Is it possible to read the Browser(Client machine) time when a request is made to the servlet? ...

Java's currentTimeMillis returns negative value(s)

Hello, I'm developing a simple 2D game in Java, everything works fine. To find the correct FPS refresh/redraw/update, I used currentTimeMillis to find the difference. The problem is that currentTimeMillis sometimes returns negative values, and the Thread.sleep will throw exception (java.lang.IllegalArgumentException: timeout value is n...