java

How can I parse REXX code in Java?

I'd like to parse REXX source so that I can analyse the structure of the program from Java. I need to do things like normalise equivalent logic structures in the source that are syntactically different, find duplicate variable declarations, etc. and I already have a Java background. Any easier ways to do this than writing a load of cod...

How to set HttpResponse timeout for Android in Java

I have created the following function for checking the connection status: private void checkConnectionStatus() { HttpClient httpClient = new DefaultHttpClient(); try { String url = "http://xxx.xxx.xxx.xxx:8000/GaitLink/" + strSessionString + "/ConnectionStatus"; Log.d("phobos", "performing get " +...

Using Sheevaplug as a basic server to run tomcat and Mysql

I'm probably going to be doing an independent study in College next semester on Java web programming with technologies such as Spring and Hibernate. I'm looking for something that can sit in the corner of my dorm room with out being loud and drawing a lot of power. The machine needs to be able to run a very low traffic tomcat and Mysql s...

How to Use Different META-INF/context.xml Files For Development and Production Environments

In Tomcat (and some other servlet containers) I can store information about my JDBC DataSource in META-INF/context.xml. This is very useful. However, the settings for my JDBC DataSource can be different in my development and production environments. I'd like to know how other people deal with these differences in an elegant way, specifi...

Struts 2 URL Parameter inside foreach

Can someone explain to me why the following code results in the error: According to TLD or attribute directive in tag file, attribute value does not accept any expressions. It always breaks whenever I am trying to set the value dynamically for the parameter of the URL. `<%@ page contentType="text/html; charset=UTF-8" %>` <%@ taglib p...

Iterate / recurse through Containers and Components to find objects of a given class?

I've written a MnemonicsBuilder class for JLabels and AbstractButtons. I would like to write a convenience method setMnemonics( JFrame f ) that will iterate through every child of the JFrame and select out the JLabels and AbstractButtons. How can I obtain access to everything contained in the JFrame? I've tried: LinkedList<JLabel> h...

Can Jython replace Java?

So many server side and the mobile Java applications use the native Java language for Java. Can we use Jython instead to build the enterprise applications, e.g. websites, application servers etc. Also what do you feel about Java ME applications in Jython. P.S. Comments on question also welcome. ...

How can I resolve the conflict between loose coupling/dependency injection and a rich domain model?

Edit: This is not a conflict on the theoretical level but a conflict on an implementation level. Another Edit: The problem is not having domain models as data-only/DTOs versus richer, more complex object map where Order has OrderItems and some calculateTotal logic. The specific problem is when, for example, that Order needs to grab the...

OOP Terminology: "Container" & "Collection"

Is the C++ term "Container" simply synonymous with the Java term "Collection" ? ...

How to find out how much java code is really executed for a given use case in a program ?

Hi, is it possible to hook up an agent or something to the jvm before starting up an application (or an appserver) and have a report showing how much of the code base in the classpath is actually executed for a given use case ? I want to figure out how much code is left out unexecuted for my simple servlet application running in an apps...

How to install Tomcat on Windows XP?

I'm having trouble installing Tomcat on my windows XP machine. I already have Apache and JDK 6 installed, what I need to know is: Which file to download from the Lastest Tomcat download page And how to install it so I can run the sample web app by going to http://localhost/ In my C:\Program Files\Java folder, I see the following fold...

How can I inherit Hibernate filters with annotations?

I'm trying to set up a Hibernate filter with annotations. I would like to specify it in a base class and make all sub classes use it but whenever I try to enable it, Hibernate fails to find the filter. Is it possible at all to inherit filter annotations? ...

Custom rendering in JSP based on type of class without instanceof

How would you properly render a list of objects in jsp with differing types? Say, for example, I have to render these different objects in a specified order. One way could be to use a common type variable or instanceof but that means having a big switch/if statement to manage them all: <c:forEach var="o" items="${bigListofObjects}" >...

TextBook question, help needed

I am trying to do an exercises in the book that asks us to write the contents of the array list to a text file, can someone give me some ideas on what i am doing wrong opposed to full solutions, do i need to make a method that returns a single string then write that? import java.util.ArrayList; import java.io.FileWriter; import java.ut...

How to use Ant?

I've been trying to understand what Ant is used for but i still don't get it. Can someone give me one use case for which Ant is used for, something I can try to see why Ant is useful and what kind of things I can use it for? I do Java development in Eclipse and I'm just getting started with servlets and Google Web Toolkit. ...

<?> vs <T>

I stumbled upon a function looking like this: public void function(Class<?> clazz) {...} What are the pros/cons of changing the method to: public <T> void function(Class<T> clazz) {...} edit: what are the compile time / runtime diff. ...

Question with frames and Java AWT

Hello, I am currently making a program with the AWT gui and I'm running into a problem. I basically want an image the top left hand corner of the screen, and a column of buttons on the right of the image. This isn't what's happening though.. When I run the applet, I click a popup saying "Start Program" and then the picture I want is in t...

Why wont my JFrame hide ?

I'm in the process of creating a GUI in Netbeans 6.1 for my senior design project but i've run into an annoying snag. Temporary Windows like my login PopUp and others wont disappear when i tell it. I've been researching how to solve this for about 2 months on an off. I've even mad a separate thread for my Pop Up but it still wont work...

In Java, what command line makes the computer click on the screen?

I'm making an auto-clicker and I can't find what command line will make the computer click on the screen. ...

Java field type for a value of a generically recursive self-type?

Given a class hierarchy where the base class defines a recursive self-type: abstract class A<T extends A<T>> { } How can I declare another class (which should not be generic in T, because such a T could vary over the lifetime of the object) with a field that can hold any subclass of A? The following does not work: public class B { ...