java

Java: Using which database technology could I persist objects? (Something that does NOT require me to take care of mapping objects to tables and back)?

Hello! I need to use an object oriented data repository for a project. It's going to be something between a wiki and a CMS. I'm not an expert in the field of persistence yet. I suppose Hibernate and Jackrabbit are the frameworks to go, right? As far as I'm informed correctly, Jackrabbit does not support annotations or other convenienc...

Convert minutes into a week to time using Java's Date and Calendar classes

Overview This is the scenario: I'm given a value which represents a portion of the total number of minutes that exist in a standard week (assuming 10,080 minutes a week and 1,440 minutes a day) starting midnight Saturday (so 0 minutes Sunday @ 12am). I need to convert this minute value into an actual time value (like 8:35am) and I wan...

RESTful application on Google App Engine Java?

I would like to create a RESTful app on Google App Engine. I would like to provide XML and JSON services. I have briefly experimented with Restlet, Resteasy, and Jersey. I haven't had much success with any of them, other than some simple examples in Restlet. Could you share your experiences creating a Restful web application on Google A...

jboss problem with JMXConnectorServer

Hello, I just installed JBoss and tried to run it from Eclipse. When I first tried to run it I got an error stating that ports 8080 and 1098 are already being bound to something else. I changed those in the config files. Here is example of where I changes port 1098 to 10098 <bean class="org.jboss.services.binding.ServiceBindingMeta...

Event-based XPCOM with java

Hello, I'm writing a toolbar for Firefox using Javascript connected to a Java XPCOM component. I want it to send a receive URLs from an external application that the java end is connected to. I can send the URL just fine, and I can load an incoming URL if I know one is there, but it's missing something crucial. There is no way for the u...

Resin server error

Hi I get this error in windows xp, when try to access http://localhost:8080. I do not see any errors in resin before hand. Also the JAVA_HOME in windows is set. 500 Servlet Exception Resin can't load com.sun.tools.javac.Main. Usually this means that the JDK tools.jar is missing from the classpath, possibly because of using a JRE ins...

UISpec4J: Returning a Trigger from a Combobox selection?

This question is for the UISpec4J testing framework, for testing Java GUIs... I'm trying to test an error message pop-up window (modal) that results from making a selection from a ComboBox, but I'm not sure how to return a Trigger object from the select action. Here's a snippet: WindowInterceptor .init(window.getComboBox("ComboBox...

How to navigate with ICEFaces and pass parameters

Hello, I'm using JSF/ICEFaces. I have a table that have many rows with values and I have another page that displays charts. I want to have an icon on every row to chart that specific combo. I know to do regular navigation with JSF by returning a string navigation rule. However, I'm not sure how to pass parameters from the bean correspon...

Is there a way to make PrintWriter output to UNIX format?

In Java, of course. I'm writing a program and running it under a Windows environment, but I need the output (.csv) to be done in Unix format. Any easy solution? Thanks! ...

How can you get the calling ip address on an ejb call?

If a java client calls a remote EJB on a different server, how can you get the client IP address? Note that it is important to get it from the server, because the client is likely behind a NAT firewall, and in this case we need the public IP address. NOTE: Although it would preferably be a generic solution, at a minimum I could use one ...

What makes a framework a "true" MVC framework?

When reading online discussions about MVC frameworks, I hear a lot of commentary pointed toward PHP projects like Cake, Code Igniter and Symfony from Java/.NET developers in the vein of "those are clever hacks, but not true MVC". So, what makes something a "true" MVC framework. i.e. what's an example of a .NET or Java MVC framework th...

How can I get Eclipse on OSX to use Java 1.6?

I just installed Java 1.6 on my OSX and everything works brilliantly, except that Eclipse refuses to start. It puts up a huge prompt from which I can't copy/paste, but it's clearly stating that it wants to be using Java 1.5 and can't find it anymore. I don't see anything in its configuration files about which version of Java it should b...

Using != with counter controlled loops

Last question for today all...I will get back with tomorrow..I have a lot to follow up on... I am looking in Reilly Java text- talking about counter controlled loop patterns..(does not matter what language..) The author for counter controlled loops (for, while, etc) and with nesting loops...uses the != for test...Now I realize != is us...

How can I change line height / line spacing in eclipse.

Hi, I am using eclipse for java programming but lines in the editor look little closer. And I want to change the amount spacing/gap between lines. Is there any option in eclipse that I can use to achieve this effect ? ...

Hibernate findByCriteria strange behaviour

I have a simple method that just does two lines and tries to return all objects in an oracle database table: DetachedCriteria criteria = DetachedCriteria.forClass(Object.class); return (Collection)getHibernateTemplate().findByCriteria(criteria); However, I got an "ORA-01031: insufficient privileges" error. When I checked the logs for ...

Asynchronous HTTP Client for Java

As a relative newbie in the Java world, I am finding many things frustratingly obtuse to accomplish that are relatively trivial in many other frameworks. A primary example is a simple solution for asynchronous http requests. Seeing as one doesn't seem to already exist, what is the best approach? Creating my own threads using a blocking t...

Force Java to call my C++ destructor (JNI)

I thought this question would have been asked before, but I couldn't find it here... I've used SWIG to create a JNI wrapper around a C++ class. All works great except that Java never seems to call the class's finalize(), so, in turn, my class's destructor never gets called. The class's destructor does some final file I/O, so unfortunate...

Best way to detect whether code is running in an application server java

For a J2EE bean I am reusing code that was developed for a java swing application. JOptionPane.showMessageDialog() is unfortunately commonly used. Most occurences luckily in code sections that are not reused by the J2EE application, but in some cases lower levels of the code has instances of JOptionPane.showMessageDialog(). Obviously thi...

What can go in the parentheses of a Java for loop?

My question is about the Java for statement, e.g. for (int i = 0; i < 10; ++i) {/* stuff */} What I don't understand is precisely how much code / what kind of code I can put in the parentheses (i.e. where I have int i = 0; i < 10; ++i in my example)- I don't really understand the language used to describe it here: http://java.sun.co...

How do I get a JList in netbeans to grab data from a vector in my model?

I'm a fairly experienced Java user, but I've just started trying to use NetBeans to build a GUI. Previously I coded GUIs by hand, but this is a bit of a bigger project. Anyways, I have a Vector in my model (MVC design), and I want to make the list populate with elements in my vector. I know how I'd do this by hand- I'd initiate the li...