java

Will JRE 1.4 support classes compiled with Java 1.5 & 1.6?

Will code compiled using 1.5 and 1.6 run on a 1.4 JRE? We weren't sure which Java versions the 1.4 JRE supports. We know that if the code in question implements 1.5 or 1.6 supported features then it definitely won't compile... and that there are some risks with "backwards compiling" but wasn't sure if the 1.4 JRE would refuse to even ...

XPath, Selenium: Element is found in XPath checker but not in Selenium!?

I have the following XPath: //div[contains(@id, 'box')]/div/h4/small/a[contains(@href, 'google')]/@href When I try out this XPath in XPath Checker (Firefox extension), it works perfectly all the time. But when I do the following in Selenium: System.out.println(selenium.getAttribute("//div[contains(@id, 'box')]/div/h4/small/a[contains...

Trimming down log output using log4j

How can I achieve the following using log4j: log only events coming from a specific category , i.e. com.example.app but not com.example.app.context or com.example.dao; log all events with a level of WARN or higher. ...

Preconfigured Virtual Machines?

I was looking at using Amazon's EC2 service after reading this article: http://www.ibm.com/developerworks/java/library/j-javadev2-4/index.html But then I wondered if there's any sense in paying for the service if really all I'm interested in is using one of their preconfigured VMs for getting java web application off the ground quickly....

Calling Java methods in a GWT module via Javacript of a Google Gears worker in a workerpool

I would like to know if it would be possible to call Java method of a GWT module within a worker in a Google Gears workerpool. For example given the class and method of a GWT module. package com.mycomp; public class MyClass implements EntryPoint, WorkerPoolMessageHandler { public void mymethod() { ... }} I have tried defining the fo...

log4j: rotating log files based on time rather than size

I use log4j with the "RollingFileAppender" to create a log rotation based on a certain size per file. How can I configure it to log to each file for a certain amount of time before rotating? For example, so that each log file contains one hour of logs, rotating at the top of each hour? BTW, I configure log4j programatically in Java us...

Publish CruiseControl LATEST build artifacts to a static URL

I have a Java multi-module maven project that I want to build a mvn site and javadocs and have CruiseControl publish the latest daily builds to a configured static location. The trouble is the CruiseControl artifactPublisher allows you to specify a dest directory but it is timestamped with the latest time of the last build. I want to be...

Returning a C++ class to Java via JNI

Hello, I'm currently using both C++ and Java in a project and I'd like to be able to send an object which is contained in C++ to my Java interface in order to modify it via a GUI and then send the modification back in C++. So far I've been returning either nothing, an int or a boolean to Java via the JNI interface. This time I have to ...

is this possible to do with iBatis + spring

usual idiom of using ibatis with spring support is following. Or this is how I'm doing it. please let me know if it can be done a better way? beans xml: <bean id="DataSource" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiName" value="jdbc/some/som1/my/mydb"/> </bean> <bean id="SqlMapClient" class="org...

key - > value store with binary attachments

An extra requirement is that the attachments can be stored as a stream, as there might be potentially very large binaries that has to be saved. Videos etc. I have looked at Voldemort and other key value stores, but they all seem to expect byte arrays, which is completely out of the question. This should, preferrably, be written in Java...

Java large datastructure for storing a matrix

Hi folks, I need to store a 2d matrix containing zip codes and the distance in km between each one of them. My client has an application that calculates the distances which are then stored in an Excel file. Currently, there are 952 places. So the matrix would have 952x952 = 906304 entries. I tried to map this into a HashMap[Integer, Fl...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity's launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would reuse a single Activity instance and give me the Intent in the onNewIntent callback. I did both of these things, and onNewIntent never fi...

How to create a calender object in java?

I need to turn a Date object into a calender in java, and try to access its field value for HOUR_OF_DAY. Does anybody know how to do it? Thanks ...

History of XML parsing and WS APIs in Java?

Someone recently asked on IRC about the history of XML parsing and WS APIs in Java, and I started wondering. Is there any written history? What are the latest and coolest toys? Why are there so many? Usually knowing the history of why things were developed and how they are supposed to improve over their predecessors helps learning the n...

Anyone know of a Java reporting tools which has a web based visual report designer?

We're currently evaluating different Java reporting engines, and having a web-based ad-hoc report designer is a requirement. We don't need anything too fancy, but we need users to be able to define a report with columns X, grouped by Y, sorted by Z, etc... We've found that many of the open source tools do have graphical report designers...

Adding test files to a Junit test in Netbeans 6.7.1 - getResource issues, missing file in build directory

I'm adding a Junit test to one of my classes using NetBeans 6.7.1, I need to be able to load a an xml file specific to testing, so I've included it in the "Test Packages" folder (along with my actual test). I'm running into 2 issues, (1) getResource is looking in the wrong directory (2) my xml test file doesn't get copied when I run t...

Displaying same image multiple times at different locations in a web page using JavaScript or CSS

I’m looking to create a web page with 6 coupons on it, two per line in a web space of 1275 X 1650. Each coupon space will consist of a different image. The problem is I will be creating 20 such web pages that will have these coupons on them. Now some of the same images will appear in different locations/positions on the various web pages...

Associate DXL with eclipse/notes and kick off handling

I need to be able to double click on a file on the desktop and have Eclipse (or more specifically Lotus Notes) kick off my custom action, to process and display it. I've found http://www.developer.com/java/other/article.php/3648736/Eclipse-Tip-Define-Custom-Content-Types-to-Identify-Your-Data-Files.htm which describes how to setup a ...

Forcing a Cocoa app called from java to take focus

I have an OSX cocoa app that is called from my java like so: String cmd = "/Users/mike/ASJPictureTaker.app/Contents/MacOS/ASJPictureTaker"; Runtime run = Runtime.getRuntime(); Process pr; pr = run.exec(cmd); pr.waitFor(); The ASJPictureTaker app loads and works fine but when the exec is called it does not take focu...

Full page refresh in Icefaces 1.8.2 ?

Icefaces only refreshes the changed parts in the page. In my program I want to do a full page refresh through the manage bean. Does anyone know how to do that ? Thanks. ...