java

Getting struts s:url includeparams to work on jboss when deploying as ROOT.war

I'm working on a webapp that uses struts 2, spring, URL Rewrite Filter and a couple of other dependencies that I'm not sure are relevant to this. One of the url's we construct is constructed as follows: <s:url id="blah" includeParams="get"> This works fine when deploying in jboss as a normal webapp dropped in deploy/. So then all urls...

Minimizing visibility in Java

Does anyone know of an automated approach to refactoring code to minimize the visibility of classes, and their properties and methods? I'm trying to clean up an old API that has way too many public getters and setters to fit with JavaBean standards. An Eclipse plugin would be ideal, but any tool that could help would be great. ...

Why don't you have to explicitly declare that you might throw some built in exceptions in Java?

I've noticed with Integer.parseInt() that you don't have to surround it with a try catch or declare that the method might throw an exception, despite the fact that it "throws" a NumberFormatException. Why don't I have to explicitly catch the NumberFormatException or state that my method throws it? ...

How do I access JAAS roles at arbitrary point in the code?

I want to access the full model of users with their roles in my SOAP app. For example, I might want to know the role of a user called "Fred." How do I reach into some sort of global JAAS registry and do (pseudocode) globalRegistry.getUser("Fred").getPricipals()? (Note that in JAAS, roles are represented by Principals.) I know how to...

What tools do you use to manage old code?

Let's say you have a Java-based product out in the market. This old code needs to be maintained, i.e. bug fixes and small feature updates. What (open-source?) tools to you use to maintain old code? To track whether a patch has been applied to all relevant branches, including the main/trunk/head? To track which versions contain the fix...

Java how to: Generic Array creation

Due to the implementation of Java Generics you can't have code like this. How can I implement this while maintaining type safety? public class GenSet<E> { private E a[]; public GenSet() { a = new E[INITIAL_ARRAY_LENGTH]; } } I saw a solution on the java forums that goes like this: import java.lang.refl...

WSDL first for existing service layer

I am working on an existing Java project with a typical services - dao setup for which only a webapplication was available. My job is to add webservices on top of the services layer, but the webservices have their own functional analysis and datamodel. The functional analyses ofcource focuses on what is possible in the different service ...

Types of Java web applications

As someone who's fairly new to Java-based web frameworks (currently learning Stripes), I was curious.. what kinds of web applications are you creating with them? I'm thinking it must be something more complicated than yet another blog engine or photo sharing app. (Or perhaps not?) I could see Stripes, Wicket or maybe Struts 2 being used ...

java screencasts for spring and hibernate

Hi I am a sql guy interested in learning OOP and Java but most of the books i read or come come across don't touch databases . Are there any screen casts available that can teach me the spring framework and the Hibernate framework directly without getting too much deeper into java. regards Eddie ...

Open-source java XSLT 2.0 implementation?

I'm currently looking into using XSLT 2.0, but I cannot find any open-source java implementations (Saxon-B seems to fit the bill, but isn't schema-aware). Am I missing something? ...

Eclipse - Compiling & executing program

In the past, I have used JCreator to develop my java applications. I wanted to try Eclipse and see its IDE. On JCreator, I could just open a java file and run it in the command prompt. On Eclipse, I cannot find out how I can compile and run a java file written by someone else without first creating a project, creating a new java class a...

Java: Format number in millions

Is there a way to use DecimalFormat (or some other standard formatter) to format numbers like this: 1,000,000 => 1.00M 1,234,567 => 1.23M 1,234,567,890 => 1234.57M Basically dividing some number by 1 million, keeping 2 decimal places, and slapping an 'M' on the end. I've thought about creating a new subclass of N...

Performance of Java matrix math libraries?

We are computing something whose runtime is bound by matrix operations. (Some details below if interested.) This experience prompted the following question: Do folk have experience with the performance of Java libraries for matrix math (e.g., multiply, inverse, etc.)? For example: JAMA: http://math.nist.gov/javanumerics/jama/ COLT: ...

Setting classpath for a Java stored procedure in Oracle

I've got an Oracle 10g database, and I have a third-party jar file. I want to be able to run a SQL select query in my database that ultimately runs code in my third-party library to retrieve info for inclusion in a SQL result set. I see lots of tutorials on "Java stored procedures" and these seem to be a promising way to do this, but n...

How to run a ksh script from java code?

I tried to run a shell script from java code, but I am facing problem. The script is in batchstart.sh file - #!/bin/ksh export DISPLAY=:0.0 Now the script is run with a dot on the command line -- . batchstart.sh How do I run it from java? My java code is below. It throws the following exception - java.io.IOException: .: not found ...

ADF Custom Components

Where is the best place to find custom compnonents? Ideally a repository, as opposed to finding a few here and there. We are currently about to re-design our look and feel UI for about 200 forms and we were hoping to find a lot of custom components... We were told they were everywhere by the pre-sales architect but even a simple google s...

2 input fields displaying the same thing

Hi guys, Bit of a strange one. I want to have a JTextField, in which the user will type a string. While typing, however, I'd like that text to automatically print to another JTextField in real time. I'm not sure if this is possible because I can't recall seeing any application do it. Anyone even seen anything like this before? Actua...

Recieving Disparate Content In Java

The Problem: I need to receive different types of content from a number of different sources normalize them and then make them persistent through JDO. Naive Solution?: Create and listen on a specific port for each data type. OR Do a bunch of complicated parsing A Seemingly Ideal Solution: Have custom URL types Ie. FOO://myhost.tl...

Debugging JVM crashes under Windows

I wrote a piece of software in Java that communicates with USB hardware by using a DLL provided by the hardware vendor. I used the Java Native Access library to write the wrappers to native code. Sometimes when I am running it, only on native code related functions, JVM crashes and I cannot find what caused the bug because it happens in ...

Spring vs Hibernate

Just trying to get my head round Spring and figuring out how I wire up an Oracle connection in xml config file, and now find out I need yet another framework! - Hibernate, this is soooo frustrating as it feels like I'm getting deeper and deeper into more and more frameworks without actually getting what I need done! I looked at Hibernat...