java

Java: Finding out *why* a class is loaded

Hello. I am currently having the problem that I have a (partial) program that is trying to load a class but fails because it cannot find this class. Looking at the stack trace, I cannot see any particular reason for why the VM tries to load this particular class at the first place. Are there any tools that would let me figure out why a ...

Java: run code for x seconds?

Hello, I'd like to write a java while loop that will iterate for 15 seconds. One way I thought to do this would be to store the current system time + 15sec and then compare that to the current time in the while loop signature. Is there a better way? Thanks! ...

OSGI - Hibernate + JBoss Seam

Hi all, I am running a JBoss Seam web application with Hibernate as the persistence provider. I am considering migrating to OSGI to simplify deployment and updates. I don't have any experience yet with OSGI, so I don't know if this can be done and what the limitations are. For instance, if I change entity classes and I want Hibernate...

Error while updating content to Google sites through API

The code to insert document data works for Google sites but for update it fails. I tried below two calls 1 entry.setMediaSource(ms); gives following //IllegalArgumentException: Cannot set media source on entry with existing non-MediaContent 2 service.updateMedia(new URL(getContentFeedUrl()), newAttachment); gives //c...

class and interface

I wonder 3 things. 1: If I have implemented an interface (with a method) in a superclass where im declaring that method, and then I extend that superclass in another class. Then I don't have to redeclare that method right? 2: But if I don't declare that method in the superclass but in the child class then I instantiate the superclass. ...

Hashtable<String, Object> not finding strings

I have a Hashtable of type Hashtable I've loaded several strings as keys, one of which is "ABCD" However, later when I go to look up "ABCD", the Hashtable returns null instead of the associated object. Further the keyset contains "ABCD", but a request to containsKey("ABCD") returns false. Is this because String objects are inherently ...

many-to-many mapping not working, one side is set to inverse.

A many-to-many relationship. The tables: Product (productId, ...) Category (categoryId, ...) Product_Category(productId, categoryId) I setup the relationship so all updates will be done via the Product entity. Product Entity: private Set<Category> categories = new HashSet<Category>(); public void AddCategory(Category catego...

Is new-ing objects obsolete?

Ok, so here's the question... is the new keyword obsolete? Consider in C# (and java, I believe) there are strict rules for types. Classes are reference types and can only be created on the heap. POD types are created on the stack; if you want to allocate them on the heap you have to box them in an object type. In C#, structs are the ex...

Feedback about JDBC Type 4 Driver for Microsoft Access

Hi, we need some data which is stored on several Microsoft Access databases on our servers, and our application will be executed on a Linux machine. So, our only alternative consist in using a JDBC Type 4 driver. In our research, we found two alternatives: HXTT - http://www.hxtt.com/access.html StelsMDB - http://www.csv-jdbc.com/st...

architectures of COBOL and Java

Can anyone tell me the differnces in styles and architectures between these very differenct approaches please? ...

Java integration with Microsoft Help

I'm writing a GUI with Swing and I'm trying to integrate a microsoft chm help file. The problem is, I don't even know where to start. Can anyone recommend a library/tutorial as a starting point for a project like this? Specifically, I'd like to know about how to open/view specific pages or inidices (I don't even know exactly what the ter...

ApplicationException - Java - Hibernate - rollback related

My question is related to Transactions and Exceptions Requirements: I have 10 records to insert into database table. And after inserting every record, I insert data into another table. So if inserting to second table fails, I want to rollback that record. Ex. Say handle cash transfer (from one account to account) for 10 persons at a t...

static initialisation vs dynamic initialisation

Why, in C++, do we prefer static initialization to dynamic initialization? Whats the big deal?if static initialization is so performant then why do new languages like Java, C# use dynamic initialization? ...

Debugging in Eclipse (Java); can't hover over a variable when breaking to view the value

Hey, Im using Eclipse to code Java (for Android) and Im trying to debug the code as I normally do (i normally do C# though). From what I can tell, debugging in Eclipse is really REALLY bad. I dont know if Im doing something wrong, but it seems to be just awful. This is the code that is being run, I get some sort of exception and I want...

Possible Memory Leak?

I've got a running java webapp, that I'm monitoring with visualVM. Here's the graph of the heap: The was tested with two sets of requests, one at 3:20 and the other at 4:40 aprox (they are represented in the graph as the only two peaks). My question is: does this means I have a memory leak? I'm worried about the middle part where, a...

Distributed computing using java RMI and CORBA

following is the problem i am facing. i will explain it will an example If there is an IT department that makes use of Java RMI and another department which make use of CORBA, if i happened to integrate those two departments spending least amount of time with least budget what are the approaches I can take could someone help me t...

Java casting problem

Here is the simplified version of the problem: SomeClass c = (SomeClass) obj.getSomeClassParent() not always but it happens sometimes to trigger exception org.somepackage.SomeClass can't be cast to org.somepackage.SomeClass How is this possible ? I suppose it has something to do with the fact that JAI imageio is native lib,...

How can I create my custom properties on xml for Android?

Hi. We have in our project a keyboard with "Key" elements, this Key elements have attributes such as android:codes="119", android:keyLabel="w" and so on. My question is how can I include an custom attribute like a "android:alternativeKeyLabel" to do something else. ...

Video encoding and decoding for RTP

hi guys i'm implementing RTSP protocol for a project in school. i can't use any ready Managers like the 1 that comes with jmf. i've tried using custom datasources and i just can't seem to get it working. got the custom datasource example from here http://java.sun.com/javase/technologies/desktop/media/jmf/2.1.1/solutions/LiveData.html...

Java: problem with hashmap and keyset()

Here's what I'm doing (it's my "homework"): the assignment is to make a map of gerbils and then flip through it using keySet() and get(key); import java.util.*; class Gerbil { int gerbilNumber; Gerbil(int i) { gerbilNumber = i; } void hoop() { System.out.println("The gerbil can ju...