java

Jython and Java nested class

Hi, I'm using Jython to write tests for a Java project. It works well, but I can't figure how to get access to a java public nested class. package mypackage; public class NyClass { public class MyNestedClass { ... } } Does somebody knows how to do this? ...

jboss with less memory

I have now 1gb ram at work(i hope that will change soon) and jboss takes almost half of it and that is too much, i turned off logging to file, what more can i do to reduce memory usage ? ...

Nested Java enum definition - does declaring as static make a difference?

I have an interface - here's a nicely contrived version as an example: public interface Particle { enum Charge { POSITIVE, NEGATIVE } Charge getCharge(); double getMass(); etc... } Is there any difference in how implementations of this would behave if I defined the Charge enum as static - i.e. does this...

Java - change focus on key press

I am writing a Java Application for Data Entry using Eclipse and SWT. Naturally it has a great many Text objects. What I would like to happen is that when user enters something into one field focus automatically changes to the next field. Thanks in advance ...

Eclipse Problems View not showing Errors anymore

For some reason Eclipse is no longer showing me Java compilation Errors in the Problems View. It is still showing Warnings. This has suddenly happened and I cannot think of anything that I have changed which would affect this. I am using the "Maven Integration for Eclipse" plugin but I have been for some time - not sure if this could ...

How to prevent a user from seeing previous users' info by hitting the "Back" button

I am developing a java web app using servlet, in order to prevent user from hitting the back button to see previous users' info, I have the following code : protected void processRequest(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException { HttpSession session=request...

Not getting the proper size of an ArrayList in JSP

I have problem in getting the number of elements in the array that i have highlighted as bold in the jsp page( i.e, <%=alt.size()%> ) if i execute this i m gettin the value as 1(but it should rather print 3) because i think i m adding that method to the array in the generator class thats y it is taking an only 1. can u please help me h...

Static nested class in Java, why?

Hi All, I was looking at the Java code for LinkedList and noticed that it made use of a static nested class Entry. public class LinkedList<E> ... { ... private static class Entry<E> { ... } } What is the reason for using a static nested class, rather than an normal inner class? The only reason I could think of, was so that Entry ...

How far do you take code coverage?

I've recently started using code coverage tools (particularily Emma and EclEmma), and I really like the view that it gives me as to the completeness of my unit tests - and the ability to see what areas of the code my unit tests aren't hitting at all. I currently work in an organization that doesn't do a lot of unit testing, and I plan on...

Getting ClassFormatError with EMMA?

I'm trying to generate code coverage reports with EMMA using tests of which some use JMockit as a mocking framework. For the most part, it works, but a few of my tests crash with a ClassFormatError, like so: java.lang.ClassFormatError at sun.instrument.InstrumentationImpl.redefineClasses0(Native Method) at sun.instrument.Instrum...

WebLogic plugin within Eclipse

I am trying to start WebLogic within Eclipse When it starts it complains like this. Unable to load performance pack. Using Java I/O instead. Please ensure that wlntio.dll is in: 'C:\bea81\jdk142_04\bin;.;C:\WINDOWS\system32;C:\WINDOWS;C:\bea81\jdk142_04\jre\bin;C:\Program Files\Java\jre1.6.0\bin\client;C:\Program Files\Java\jre1.6.0\bi...

KDTree Implementation in Java

I'm looking for a KDTree implementation in Java. I've done a google search and the results seem pretty haphazard. There are actually lots of results, but they're mostly just little one-off implementations, and I'd rather find something with a little more "production value". Something like apache collections or the excellent C5 collection...

EMMA coverage tool not displaying line-by-line coverage

I am using the EMMA tool for code coverage yet despite my best efforts, EMMA is refusing to see the original .java files and generate coverage on a line-by-line basis. We are using ANT to build the code and debug is set to true. I know that EMMA is measuring coverage as the .emma files seem to be generating and merging correctly. The re...

Will setting the only reference to null mean it and its child threads are garbage collected?

I have an application which has to live as a service, I create an object which then spawns off a buch of threads. If I set the only reference to that object to null will all the child threads get cleaned up? or will I suffer from a memory leak. Do I have to explicitly terminate all the child threads? ...

Design Pattern to apply conversion to multiple properties in multiple classes

I am using the WMD markdown editor in a project for a large number of fields that correspond to a large number of properties in a large number of Entity classes. Some classes may have multiple properties that require the markdown. I am storing the markdown itself since this makes it easier to edit the fields later. However, I need to co...

Preserve JTable selection across TableModel change

We're seeing JTable selection get cleared when we do a fireTableDataChanged() or fireTableRowsUpdated() from the TableModel. Is this expected, or are we doing something wrong? I didn't see any property on the JTable (or other related classes) about clearing/preserving selection on model updates. If this is default behavior, is there a...

How to determine database type for a given JDBC connection?

i need to handle resultset returning stored procedures/functions for three databases (oracle, sybase, MS-Server). the procedures/functions are generally the same but the call is a little different in oracle. statement.registerOutParameter(1, oracle.jdbc.OracleTypes.CURSOR); . . . statement.execute(); ResultSet rs = (ResultSet)statem...

Should javac find methods outside of an anonymous class of the same name?

This question is a follow up to: Why can’t I call a method outside of an anonymous class of the same name This previous question answer why, but now I want to know if javac should find run(int bar)? (See previous question to see why run(42) fails) If it shouldn't, is it due to a spec? Does it produce ambiguous code? My point is, I t...

Would syntax for composition be a useful addition to Java?

First off, I know next to nothing about language theory, and I barely know any other languages except Java, but I had an idea that I think would be cool, but I need you guys to tell me: a: why it sucks b: how language x has had that for years c: how my mind sucks d: all of the above The idea would give composition the same ease of code ...

Map of collections

I wanted to make Map of Collections in Java, so I can make something like public void add(K key, V value) { if (containsKey(key)) { get(key).add(value); } else { Collection c = new Collection(); c.add(value); put(key, value); } } I've tried to make it with something like public class ...