java

What are the key concepts/technologies/architectures that a mid-level java developer should know?

What are the key technologies, design patterns, architecture that a mid-level (4-6 years) java developer should know? When I seem have start having a grasp of the Java landscape, I turn over another stone and it opens up a whole new area that I haven't experienced. I've recently read through "Java Concurrency In Practice" and it's ch...

java: easiest way to populate a bean using servlet params

without using any big web framework (just servlets), do you know a ready to use small library that can populate my bean properties from the params of an http request? ...

Using Ant with PHPUnderControl Gives java.lang.NoClassDefFoundError

I've installed the latest CruiseControl and PHPUnderControl, and followed all the directions. I get stuck at running "../../apache-ant-1.7.0/bin/ant checkout" and get the output below. Searching for the error on Google, it was suggested to add the JVM path to the Ant script, but this did not change anything. Even "ant --version" outputs...

Is it possible to synchronize JUnit test cases with the classes under tests within Eclipe?

I know it is possible to create a TestCase or TestSuite with the wizard within JUnit, but how does one sync the code after the class under the test has been modified, such as method signature modification or newly added methods. I would like my TestCases to be able to sync up (remove or add) those changed methods/parameters/method signat...

create initial data for hibernate driven testing

Hello good people! first of all thank you all for reading this. i want to populate my database (derby) every time i run the test class to be able to perform test like delete or update or deletebyid stuffs. I use <property name="hibernate.hbm2ddl.auto">create</property> in my hibernate.cfg.xml file so i'm expecting the database to be ...

delete derby tables when program ends

I'm using in-memory derby db for my java application. I would like to delete all the tables/databases it created once the application ends. So when it starts back up, I want it to start fresh. ...

How do you pull up the java console in OpenSUSE or Ubuntu?

Hi, I'm working on a java applet, and I was wondering where the heck System.out was going in Ubuntu/OpenSUSE. In windows, I just pull up jconsole, but I've not found this in Ubuntu/OpenSUSE. Thanks. ...

How do I run a java program from a different directory?

I have a java program that I would like to be able to run from anywhere on my machine. I would like to run it from my Cygwin command prompt. I've made scripts to call the java program. I added the location of the java program to the classpath, and the scripts work when I run them from the java program's directory. However, when I try...

What happens at compile and runtime when concatenating an empty string in Java?

This is a question that arose mostly of pure curiosity (and killing some time). I'm asking specifically about Java for the sake of concreteness. What happens, in memory, if I concatenate a string (any string) with an empty string, e.g.: String s = "any old string"; s += ""; I know that afterward, the contents of s will still be "any ...

Using two (or more) objects as a HashMap key

I want to store certain objects in a HashMap. The problem is, usually you just use a single object as a key. (You can, for example, use a String.) What I want to do it to use multiple object. For example, a Class and a String. Is there a simple and clean way to implement that? ...

Does entrySet() in a LinkedHashMap also guarantee order?

I am using a linkedHashMap to guarantee order when someone tries to access it. However, when it comes time to iterate over it, does using entrySet() to return key/value pairs guarantee order as well? No changes will be made while iterating. EDIT: Also, are there any adverse effects from iterating through the map by iterating through its...

is this a pattern, a bad idea or something you know how to improve?

Given a class hierarchy like this one: a package tree would it be a good idea to have a class that helps in creating the objects? E.i. a class with methods that correspond to each class that can be created (method equals() returns a CompareCriteria eg). The advantage I see is that it would hide away the complex inheritance structure and ...

Pass mouse events to applications behind from a Java UI

Hi, The question I have is exactly same in requirement as http://stackoverflow.com/questions/173579/how-to-pass-mouse-events-to-applications-behind-mine-in-c-vista , but I need the same for a Transparent Java UI. I can easily create a transparent Java UI using 6.0 but couldn't get any info about passing events through the app to any appl...

toLowerCase with special/unicode characters throws exception

correct me if I'm wrong. If str has a character such as "•" in it then running: str.toLowerCase(Locale.English); throws a null pointer exception. That's the behavior I'm seeing. So what's the deal here? What's going on? It isn't specified that toLowerCase throws a null pointer exception. Is there an easy way to get around this? I n...

Is there a way to set the delay time of tooltips being displayed on a particular component in java swing?

I'm trying to set tooltips on a JEditorPane. The problem is that the method which I use to determine what tooltip text to show is fairly CPU intensive - and so I would like to only show it after the mouse has stopped for a short amount of time - say 1 second. I know I can use :- ToolTipManager.sharedInstance().setInitialDelay() however ...

How do you load a bean into Spring MVC's application context?

As I understand it, Spring MVC application has two distinct contexts, the application context and the web context, which are controlled by applicationContext.xml and dispatcher-servlet.xml, respectively. Inside my controllers, how do I go about loading a bean into either of these contexts? Note that I am aware of Getting Spring Applica...

What is the purpose of jvm.cfg file in relation to Java ?

It has some strange keywords. Please explain the general purpose of the file. ...

Equinox (OSGi) and JPA/Hibernate - Finding Entities

I am trying to use Hibernate/Spring in an OSGi (Equinox) environment. It works great if I explicitly point it to the Entity classes in the Persistence.xml: <class>com.es.t.eee.domain.StuffSource</class> <class>com.es.t.eee.domain.PostalAddress</class> What I want is for Hibernate to "find" all of the Entity classes just as it does ...

Java: Class entirely run in second thread / IllegalMonitorStateException

Hello When you want a certain task to be executed by another thread, you can extend Thread or implement Runnable. I've made an attempt to create a class which runs a class entirely in the second thread. This means that you can call anyMethod() which returns immediately and which is executed by the second thread. Here is my attempt:...

Preventing an embedded applet from launching immediately?

Due to timing issues, I'm trying to prevent an applet from loading until a page is completely loaded ($(document).ready(...);). However, I'm using the java deployment toolkit to launch the applet, which naively uses document.write to push data to the browser. Obviously, this breaks horribly if I attempt to run the applet after the is wr...