java

Unable to get ResultSet from the MySql DataBase.

When I execute the following query on a database containing a table "comm_list" and a field "sr_no" of type "Int" in the table "comm_list", I get the correct resultset SELECT MAX(sr_no) FROM comm_list; The above query is to get the max. serial no. so that when I enter a new record, I enter the (serial no. + 1) in the "sr_no" coloum so ...

How to sort the MySql Database?

I have stored various records in the MySql database "orkut". Now I want to sort that database through a java program. I have connected to the database through the jdbc driver. Now I want to sort that database in decreasing order of the field "number" of type "int" but don't know the commands. I have "con" reference variable which denotes...

Reusable Hibernate EntityManager (J2SE)

Hello, we are developing a J2SE application and we are using Hibernate for our persistence layer. For our database access I created a singleton class that has all the necessary methods to obtain and persist objects from the database. But once I created the second method for obtaining objects I immediately realized that I have a smelly co...

Extending Generic Abstract Class & Correct Use of Super

public abstract class AbstractTool<AT extends AbstractThing> { protected ArrayList<AT> ledger; public AbstractTool() { ledger = new ArrayList<AT>(); } public AT getToolAt(int i) { return ledger.get(i); } // More code Which operates on Ledger ... } public class Tool<AT extends AbstractThing> extends A...

Add a ActiveX Control to a JPanel

Hi, Is there any way to add a ActiveX control to a JPanel. ...

Using an ActionListener in one class to start a timer in another class.

I have a class (simulation) which creates an instance of another class (GUI). Inside the class GUI there is a button (start) which has an actionlistener attached to it. I need this actionlistener to start a timer in simulation but I can't figure out how to do it. Code in Class Simulation: public class Simulation{ private static JFram...

Auto-Generating EJB3 Entity Beans

Hi, I would like to know if there are any tools to automatically generate EJB3 Entity Beans(for JPA) from a database schema. Thanks. ...

Display another modal dialog box on top of other modal dialog boxes in Java

Hi, I have a rather strange question: I have a Java application which uses "applications" (plugins) run in different threads. Most of these plugins will be written by other people and I will have no control over the code. The application requires a permanent connection to the Internet as information is constantly transferred between the...

Best and simple way to call .net assemblies in java

Hi guys, Exists a way to call .net assemblies more specific .dll files in java? I i'm developing a a framework for .net now i need to migrate it to java, i can do this? I using c# in .net. ...

Java Executors: how can I stop submitted tasks?

I have submitted a task using executors and I need it to stop after some time (e.g. 5 minutes). I have tried doing like this: for (Future<?> fut : e.invokeAll(tasks, 300, TimeUnit.SECONDS)) { try { fut.get(); } catch (CancellationException ex) { fut.cancel(true); tasks.clea...

Java: Remove double from string and store in array

Hi folks, I have a string that will be different each time but follow the form of -3.33,-46.53,37.39,26.55,97.11,68.46,-32.46,-5.89,-62.89,-7.9, and i want to remove each number and store as an double in an array. even pseudocode would be great i'm drawing a blank. Cheers ...

IntervalTree Java Implementation

I need an IntervalTree or RangeTree implementation in Java, and am having trouble finding one with working deletion support. There's a built-in one at sun.jvm.hotspot.utilities.IntervalTree, but the deleteNode method in the RBTree superclass states: /** * FIXME: this does not work properly yet for augmented red-black * trees since it...

JDO vs JPA for Java on Google App Engine

I want to develop my project on Google App Engine with Struts2. For the database I have two options JPA and JDO. Will you guys please suggest me on it? Both are new for me and I need to learn them. So I will be focused on one after your replies. Thanks. ...

Media streaming server java for mobile phone clients

i need to build a audio/video streaming server in java. i am thinking of using mp4 container format and real time protocol. i might want to modify the codec for my need. i don't know what apis to use for this. i don't want to implement code to parse mp4. could someone give me a direction? ...

How do I load/unload a Linux kernel module with a Java Program?

I'm looking to load and unload a linux kernel module from my Java program. I initially tried doing it by using ProcessBuilder to run the commands, however it fails because the program doesnt have root access. Running my program as root also yields the same problem as it's a different process which needs the root access. So how do I acq...

Java: Parsing a string to a double

Hi folks, I'm reading a file into an array and trying to take out the numbers and put them as a double in an array of their own. And apparently my middle name must be "Error". From what I can tell the code is ok....at least theres nothing jumping out at me. Here it is in all it's glory. import java.io.BufferedInputStream; import java.io...

Accessing Access over JDBC (using ODBC?)

Hi, I'm looking for a way to open an Access MDB file inside a Java App (using JDBC). A quick Google Search suggests that I need the JDBC-ODBC Bridge for this... Does this mean that I need to configure every system I want to run my app on to provide a ODBC DSN for the MDB I want to open? And one more question (since I've never used OD...

How do you use the crypt library in C for DES encryption? (setkey, encrypt, crypt, etc.)

I need to do some simple DES encryption in C to interface with some old code. From what I understand you can use the "crypt" library for this, with the functions setkey, encrypt, crypt, etc. I have been messing with it and can't get it right. The example on the man page for setkey/encrypt is lacking. I want to get the same output as I w...

Why is JMS not included by default in JDK ?

JMS API is not part of JDK 6 as JDBC is. Why is JMS not a part of JDK? Is it because is very old with no progress? ...

Recommended books to learn Java / web applets

I come from a few years experience in .NET, and played a bit with Java during my uni studies. Could you recommend any good books to learn the best ways to develop a Java web applet? ...