java

java.lang.NoSuchFieldException: when using reflection

public static <A, B> B convert(A instance, Class<B> targetClass) throws Exception { B target = (B)targetClass.newInstance(); for (Field targetField : targetClass.getDeclaredFields()) { targetField.setAccessible(true); Field field = instance.getClass().getDeclaredField(targetField.getName())...

required info about j/xfs

What exactly is j/xfs in simple terms? ...

Embedded SQL in OO languages like Java

One of the things that annoys me working with SQL in OO languages is having to define SQL statements in strings. When I used to work on IBM mainframes, the languages used an SQL preprocessor to parse SQL statements out of the native code, so the statements could be written in cleartext SQL without the obfuscation of strings, for instanc...

What are *.snap files in eclipse?

I have so many projects in workspace. for every one or two weeks i have to search for *.snap file delete them. otherwise my eclipse will take lot of time to come up? So curious to know what are they? are they specific to java? as i have lots of java projects in my workspace? ...

integrating springMVC and extjs

I am using springMVC and hibernate in my current j2ee project. The view as of now consists of plain jsp, with JSTL to make things a bit simple. Looking at the extjs project, I believe it can be used as a substitute for the view. I have been looking at the extjs docs but frankly, I am not sure how to integrate it in spring. Does anyone ...

How to change the default output from a Maven 2 / Cobertura instrument goal?

Hi there, when i instrument my classes using Maven 2 using the command mvn cobertura:instrument The output (the instrumented classes) are put in \target\generated-classes. Is there a way to change the output location to \target\classes? I checked the instrumentation tasks of the cobertura-maven plugin but this does not give me a ...

where can I find websites with good java source codes that work?

HI. I am a beginner/intermediate java programmer.I'd like to see codes of useful applications used in the real world. Could anyone tell me where to look for such source codes? thanks. ...

Porting from Cobol to Java

What differences are there between the top level architectures of Cobol and Java? What are the styles and cultures that programmers adopt in these two languages? How can one best port from Cobol to Java? ...

how to develop and run ejb in netbean6.7?

Hi,I am beginner of studying EJB . I want to test very very small ejb application in netbean 6.7. The code are as follows package jeenptbeans; import javax.ejb.Remote; @Remote public interface NewSessionRemote { public String getEchoString(String clientString); } package jeenptbeans; import javax.ejb.Stateless; @Stateless publi...

Can I add a button to a JTable column header?

I have a JTable where the first column in each row is a checkbox. The user can select and deselect individual columns. I've got this working. Now I'd like to add to the column header a checkbox which can be used to "select all" and "deselect all". I'm puzzled in how I should go about doing this. I can't work out how to put a component o...

Which other programming language has similarity to Java?

I am a Java professional. Now I like to move other programming language. Can anybody suggest me which programming language would be better to digest soon and language has web devlopment features .I am interested in web-devlopment. ...

Manipulating Lists and Collections

I recently came across a module in my application which heavily uses Collections and Lists. And yeah its in Java. So either for performance reasons or whatsoever the author has used Lists and also maps in so many places. He does the usual operations on it like deleting some elements, adding, updating the list and every time he does that...

Best way to calculate differnce between two times in java?

Hi, I have two times in an array and I need to calculate the difference between both of these. I have converted the hours into mins, then added the remaining mins. This gives me the total minuites overall, once I did this for both I simply minus one total mins from the other. Then converted them back to hours and minuites. double no1 ...

Design Patterns in Database Applications with Java (JEE / JSE)

Hello everybody, I've been reading StackOverflow for quite a while now and I'm only now building the nerve to ask a question. I'm 20 years old and currently enrolled in college in IT here in my hometown (Cluj-Napoca, Romania). Enough for introductions :D. Basically I have my little software firm that provides Book-keeping appz. They're...

GWT's CssResource in IE

With GWT 2.0, I can't get CssResource to work properly in IE. I'm using NotStrict css resource, with some top level selectors like "html, body". It works well in webkit & gecko browsers, in IE, only a few CSS rules are injected, like 5% of my stylesheet. It's very hard do debug. ...

How to express "never" with java.util.Date?

I have a class with the fields "deletionDate" and "experiationDate" which could both be undefined, what would mean that the object is whether deleted nor has an expiration date. My first approach was: private Date deletionDate = null; // null means not deleted Having the book "Clean Code" in mind I remember to better use expressive ...

What's the difference between Spring BeanFactoryAware and ApplicationContextAware?

Both can be used to get bean instance, but which one is better to be used to implement? ...

A better way to run lots of Integration Tests using JUnit?

What is the best way run a lot of integration tests using JUnit? I crudely discovered that the code below can run all the tests... but it has a massive flaw. The tearDown() method in each of those classes is not called until they have all been run. public class RunIntegrationTests extends TestSuite { public RunIntegrationTests(){ ...

What is the best way to initialize a complex static member in Java?

My objective is to have a private static Properties object in my class, to act as defaults when creating other Properties objects needed by my application. The current implementation looks like this: public class MyClass { private static Properties DEFAULT_PROPERTIES = new Properties(); static { try { DEFAULT...

Spring UncategorizedSQLException: ORA-01012

I am trying to retrieve data form an Oracle database using jdbc (ojdbc14.jar). I have a limited number of concurrent connections when connecting to the database and these connections are managed by Websphere connection pool. Sometimes when I make the call I see an UncategorizedSQLException exception thrown in my logs with one of the fol...