java

Selecting main class in a runnable jar at runtime

I have two main classes in the app. When I package it to a runnable jar (using Eclipse export function) I have to select a default main class. Is there a way to access the non-default main class from the jar at runtime? ...

Java "equivalent" to CSLA

I've read several chapters of the CSLA book and I like it, but being lately geared more towards Java, I'm looking for a Java-based equivalent. Does anybody know anything that comes close to CSLA in Java? I would also settle for a good combination of other existing technologies that would achieve similar goals. ...

Creating RSA keys from known parameters in Java

I'm working on implementing Bing Cashback. In order to verify an incoming request from Bing as valid they provide a signature. The signature is a 160-bit SHA-1 hash of the url encrypted using RSA. Microsoft provides the RSA "public key", modulus and exponent, with which I'm supposed to decrypt the hash. Is there a way to create the Jav...

Java Font Rendering (Redux) - Must general AA really be turned off for subpixel AA?

I have been attempting to enhance my GUI system written in Java to use subpixel antialiasing and have been successful, except for one remaining anomaly. This is a follow on to my other question from yesterday. The remaining problem is that setting rendering hints KEY_ANTIALIASING to VALUE_ANTIALIAS_ON causes KEY_TEXT_ANTIALIASING to be ...

Using Servlets and HTML

Hi, I have a doubt regarding the use of servlets. In the application I'm building I use Html pages to ask the user for info. Imagine a Html page that lets the user request to see on the screen the content of a data base. What I'm doing is: 1.- From the Html page I'm calling a servlet that will open a connection with the database. 2....

dependency management with maven

I have lately become a big fan of Maven for controlling the build cycle for my application. However I've encountered some rough edges with Maven's dependency management. I'm wondering if these are limitations of the tool and paradigm, necessary evils of dependancy management, or if I"m just using the tool incorrectly. First is the ...

What API's provide Nokia for Sound to text and text to sound transformation?

What API's provide Nokia for Sound to text and text to sound transformation for Java or C++ programmer? What do I need? Links to best API's of your choise Links to best Blog Articles/Tutorials on topic ...

Get column name of property mapped with Hibernate

How can I access the Hibernate mapping of my model to find out the column name of a property? The column name is not specified in the mapping so Hibernate generates it automatically - I would like to create a native SQL statement including this column name. ...

Please verify: this converter reads the byte array as Big-Endian?

Hi! Im am porting some stuff from C# to JAVA and I need a class that can convert bytes to primitives, just lite BitConverter in .NET can. As I just posted here, I noted that my computer uses Little-Endian (Intel) and BitConverter works as expected: // C# code byte[] b2 = new byte[] { 0, 1 }; short b2short = BitConverter.ToInt16(b2, 0)...

Javac flags and Eclipse settings to process Class.<GenericType>method() invocations.

It happens to see Collections.<Object>asList(...) method invocations in the code, but Eclipse seems do not understand this(with my configuration) and shows this as compilation error. Is my Eclipse configuration wrong? Or this doesn't work with Sun compiler (jdk 1.6.013)? What should I check / enable for thing like this? ...

How I can add JScroll bar to NavigableImagePanel which is an Image panel with an small navigation view?

Hi, I have the following NavigableImagePanel, it is under BSD license and I found it in the web. What I want to do with this panel is as follow: I want to add a JScrollPane to it in order to show images in their full size and let the users to re-center the image using the small navigation panel. Right now, the panel resize the images ...

regex VS Contains. Best Performance ?

I want to compare an URI String over different patterns in java and I want fastest code possible. Should I use : if(uri.contains("/br/fab") || uri.contains("/br/err") || uri.contains("/br/sts") Or something like : if(uri.matches(".*/br/(fab|err|sts).*")) Note that I can have a lot more uri and this method is called very often. W...

Monitoring a Java web application - is JMX the right choice?

Hi, We have a Java web application and we'd like to set up some basic monitoring with a view to expanding this monitoring in future. Our plan is as follows: (1) Collect generic information (e.g. memory and threads) about the virtual machine of the web container that application is running in. (2) Monitor the "state" of the applicatio...

Through Java, make a call to Javascript functions on networked device?

I am doing device monitoring on a networked system. I need to know how to make Javascript calls on that device via its IP address to get certain status information (this device's status is only available through Javascript APIs, not SNMP, etc). I am working in Java. ADDED: The specific device is an Amino set-top-box. It has what it call...

Tools for automated benchmark testing of Java apps?

Does anyone know of any tools for automated benchmark testing of Java applications? By benchmark testing, I mean comparison of results to previous results and/or presenting results along a continuum of bad-to-good rather than pass/fail. ...

Java Problem/Program

Given a string of characters as input, without using regular expression or pattern matching, how to get the output, if the characters matches aaa should output 1 and if the characters matches aBa should output 2. (Note: Should not re-process characters so as to output both “1” and “2” when processing the same input) So for example: giv...

jsp, servlets, faces and beans?

i´ve read a little about java's structure and could someone tell me if my view of all these components are correct: JSP corresponds a View Servlet corresponds a Controller Bean corresponds a Model Faces correspond layouts to render display is this roughly correct? ...

Frameworks for developing a web UI on Linux (preferably with Java)

Hello I'm asking this question because I'm having some difficulty choosing a framework (or selection of technologies) that I can learn and use for developing a web-based UI for a small Java application: For background information relating to the app I'm developing please read this question: So, developing the Java application is going...

Java Crashing Windows

I have been developing a Java application using J2EE and a Derby database. My boss does most of the testing and I do most of the coding, but he has come to me with a strange problem. He claims that occasionally the Java application "crashes his computer". To mention a few details, first let me say that I am currently working remotely, s...

Deleting an element from one-to-many collection (Java + HIbernate + Struts)

Hi all, I can't delete a child object from the database. From the org.apache.struts.action.Action.execute() method, I am removing the child from the parent's List, and also calling session.delete(child). I've simplified the code below and only included what I believe to be relavent. Hibernate Mapping <class name="xxx.xxx.hiber...