java

JUnit 4 @BeforeClass & @AfterClass when using Suites

When using this approach below, by setting up the jUnit with Suites. We got the problem when all @BeforeClass in every Testclass will be executed before any tests starts to execute. (For each n TestClass file the @BeforeClass runs, then after they have execute, it started to execute the first MyTest.class files @Test) This will cause th...

Berkeley DB JE - open cursor count

Is there a way to ask the API for a list of open cursors (or at least a count of the number of currently open cursors) ? ...

Inheritance concept

In Inheritance concept, i have a static method in super class and i am inheriting that class to one sub class. In that case the static method is inherited to sub class or not? ...

Sorting technique followed by TreeMap?

Can anyone explain how the data are sorted in a TreeMap automatically when we try to print the data stored in them? ...

Java and .Net interoperability

I'm attempting to use the WebI ReportEngine SDK (AKA RENET) to change the Universe that is assigned to a WebIntelligence (WebI) rpeort. Much research led me to the changeDataSource() method (exposed by the Java version of the SDK, AKA REBean). Unfortunately, the changeDataSource() method isn’t available in the .Net version of the WebI ...

Doing XML extracts with XSLT without having to read the whole DOM tree into memory?

I have a situation where I want to extract some information from some very large but regular XML files (just had to do it with a 500 Mb file), and where XSLT would be perfect. Unfortunately those XSLT implementations I am aware of (except the most expensive version of Saxon) does not support only having the necessary part of the DOM rea...

Is it possible to start/stop Tomcat with keyboard shortcuts in Eclipse?

I'm trying to work in Eclipse as much as possible without a mouse. I cannot find a key binding for starting and stopping servers quickly in Eclipse WTP (Web Tools Platform). One way to start a server is to switch to the package explorer (Alt+Cmd+Q P), select the project (up/down arrows) and then the "debug on server"-key binding (Shift+...

java: convert package name to path ?

I have a class de.xyz.MyClass which is stored in de/xyz/MyClass.java How can I get this path inside the class MyClass ? ...

Tomcat / jBOSS sessions - where are they usually stored?

Preface: I'm not a java developer. I have a question about Tomcat / jBOSS and other java application servers. Where are sessions (session data) stored? In PHP, sessions are usually stored in the database which means you can easily share session data in a load balanced environment. In Tomcat and other application servers, session seem...

How to pass sockets created to another Java Process

Hi; We have an application which creates many sockets which belongs to its thread, By design if this application somehow fails, all threads stop which is not wanted. So to overcome this issue, each thread must be separated from the main application, if one of the threads fails, the other ones should be running. One thing in our mind is t...

Does ImageIO read imply anti-aliased scaling?

I've replaced the Java internal ImageFetcher with an own implementation using ImageIO. Some image renderers of our software, which use these images, now draw anti-aliased scaled images instead of non anti-aliased. The only change is the source of the image, which are now BufferedImages instead of Toolkit-Images. The question now is, whe...

JSF: How to forward a request to another page in action?

I want to forward request to another page from action class I am using below code in my jsf action : public String submitUserResponse(){ ...... ...... parseResponse(uri,request,response); .... return "nextpage"; } public String parseResponse(String uri,request,response){ if(uri != null){ RequestDispatch...

Tom pattern matching extension Java

Can anyone suggest an interesting real world programming problem that might use the Tom pattern matching extension? Thanks in advance. ...

Java sync games: synchronized && wait && notify

I'm coming from .NET world, and unfortunately looking Java source with .NET's eyes. Following code is from Android Apps (though not Android specific at all): private class Worker implements Runnable { private final Object mLock = new Object(); private Looper mLooper; Worker(String name) { Thread...

Number of Threads in Java

How can i see the number of threads in a java? ...

Set Hibernate root folder

Dear All! I use Hibernate in an extension-like server-side application, and I put my binaries to the Extensions folder of the server application. The problem is, that if I run the server, the root folder is the root folder of the server application, and not the root of the binaries. Thus, Hibernate searches the config file in that folde...

Disable Struts 2.1 Dynamic Attributes

Is there any configuration option which can be used to disable the dynamic attributes feature in Struts 2.1? I use an older webserver which does not support dynamic attributes. Ideally I'm hoping for an alternative DTD or a configuration option in struts.xml ...

JUnit report on Eclipse

The JUnit integration with eclipse is very nice. However, I would like a feature to be able to generate a quick report from the Unit Tests. It is possible to do so when running a headless build (and my nightly build is configured to do so), but sometimes I want to generate a report from the UI. Is there anyway to do this? command line...

Conditional Java compilation

Hi all, I'm a longtime C++ programmer, new to Java. I'm developing a Java Blackberry project in Eclipse. Question - is there a way to introduce different configuration sets within the project and then compile slightly different code based on those? In Visual Studio, we have project configurations and #ifdef; I know there's no #ifdef in...

How to convert nested List into multidimensional array?

In Java I want to convert a nested List which contains at the deepest level a uniform type into an multidimensional array of that type. For example, ArrayList<ArrayList<ArrayList<ArrayList<String>>>> into String[][][][]. I've tried several things and I only can obtain an array of objects like Object[][][][]. For 'simple lists' it seems ...