java

Quartz scheduler not displaying Log4j messages.

Hi All, I am trying to configure my Quartz scheduler to support logging. I had tried doing following: Added log4j.xml in classes folder of my app. The code for the same is: log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.Target=System.out log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.ap...

Why the awkward Design of System.out?

Has anyone got an idea regarding the motivation behind the awkward design of the java.lang.System.out? Awkwardness: First, the out member is exposed (Encapsulation anyone?). Second, it is final but can be changed via setOut() (contradicts final). ...

Adding many frameworks to a Java application - will it have any negative side effects?

If one adds many framework dependencies to a Java application, will this increase its memory footprint drastically, because it preloads all libraries at startup or is that a more lazy behaviour which would load only the needed classes when you actually need it (e.g. import statements or even later)? Could adding many dependencies also h...

Strategies for migrating medium-sized code base from Java 1.4.2 to Java 5

I'm in the process of reviewing a code base (~20K LOC) and trying to determine how to migrating it from 1.4.2 to 5. Obviously, it's not an overnight project and the suggestion which I have received is to write new code against Java 5 and migrate the old code in a piece-meal fashion. Also, I'm no expert in the new features in Java 5 (i.e....

LinkageError JAXB 2.0 -> 2.1 (Tomcat)

I'm getting this error when trying to access my webservice running inside tomcat. Caused by: java.lang.LinkageError: JAXB 2.0 API is being loaded from the bootstr ap classloader, but this RI (from jar:file:/C:/software/tomcat6/webapps/messagin g/WEB-INF/lib/jaxb-impl-2.1.5.jar!/com/sun/xml/bind/v2/model/impl/ModelBuilder.c lass) needs 2...

Best programming process for creating a graphically-complex Java Swing Application?

I'm starting a fairly complex Swing application that heavily graphics-oriented with about 1000 separate jpegs, 30+ different forms, and timers keeping track of the rate of user-interactions throughout. My question is from a practical programming perspective, after I've already written a storyboard for the entire project and got it appro...

Android coverflow

Im writing an app for android and would like to have an itunes like coverflow preview. Is there anything in the api that I can use or do I have to build it from scratch? ...

Converting a Stripes application to use Friendly URLs

I am working through Fred Daoud's Stripes book and trying to convert the Hello World application to use friendly URLs, as I'm not a big fan of suffix-based mappings like http://localhost:8080/getting_started/Hello.action. Here is the before ... index.jsp: <jsp:forward page="/Hello.action"/> web.xml: <servlet-mapping> <servlet-n...

portlet 2.0 (jsr286) development with spring

Hi! We are discussing whether it's a good idea to switch from plain portlet development on a liferay installation to spring webmvc portlet based development. We're starting the development of some portlets soon, so now is the time. But the problem I see is that we'd like to use some of the portlet 2.0 features, which won't work with ve...

Optimize memory usage of a collection of Strings in Java

I have a large number of name - value pairs (approx 100k) that I need to store in some sort of cache (say a hash map) where the value is a string with an average of about 30k bytes in size. Now I know for a fact that a large number of the values have exactly the same string data. In order to avoid having to allocate the identical strin...

Should the Java "this" keyword be used when it is optional?

From what I gather as a Java beginner, when accessing instance members, the "this" keyword may apparently be used, but is not mandatory. I wonder whether there is any official recommendation of sorts of a style guide (though I was unable to find anything in the actual Java style guide). How do people usually do this, or is there maybe...

No blanks in JTextField

How can I forbid users to put blanks into a JTextField? It should not even be possible to write blanks. ...

How can I open a UNC path from Linux in Java?

Are there any libraries available that will allow me to read from and write to a Windows Fileshare given a UNC path from Java on Linux. It's trivial on a windows box itself, and I'm aware of smbclient approaches, but I'm looking to do it by dropping in a library. Thanks. ...

client-side applet caching?

Is it possible to cache a jar file used in an applet on the client-side? I am reading conflicting information: it appears you can set a "cache" parameter with <object> + <param> However - I guess <applet> is the preferred way to go? I have not seen any sort of cache attribute for the applet tag. Does anyone know of a way to c...

How to use SAXParseException effectively in Java

Hi, I'm validating against XMLSchema in Java, and getting SAXParseExceptions thrown when I have non-valid content models. I'm going to be using these exceptions to highlight where the validation has failed - but the SAXParseExceptions seem to be a little too low-level. For example, for a failure on an enumeration, I get the validity e...

bold fixed fonts in Java Swing

I'm trying to use fixed width fonts in Java. I can use Courier or Lucida Console, but when I apply a "bold" style, it makes the characters larger in width and that's not acceptible in my application. Is there anyway I can force the bold characters to have the same width as non-bold characters? ...

Java Enums can have behavior?

In Java, an Enum can do the great things that Enums do, but can also have methods (behavior and logic). What advantage does that have over using a class using an enum? Simple examples to illustrate the point would also be welcome. ...

Detect user logged on a computer using Java web app

Hi! I want to develop an Java application that can detect the user logged on a Window Domain. These credentials are going to be used to logging on the Java application running on Tomcat. How can I do this? I want to know the remote user accessing my web app. This user is logged on a active directory Thanks! ...

Diff on Java class signatures?

Given two JAR files for the same Java library, is there a tool that will do a diff of the method signatures between the two jar files? ...

Spring MVC web app i18n

In a web application written using spring-MVC, I want to allow users to change the current language by clicking on a link which text is the name of the language. I have already set up a messageSource and made all my jsp pages find the messages using this messageSource. Currently, the language is changing depending on the locale of the ...