java

64 bit version of Java 1.4.2 for Windows?

Is there a 64 bit version of Java 1.4.2 for Windows? I need this because of a BEA WebLogic 8.1 application that runs out of memory all the time. UPDATE: As Tom Hawtin pointed out there are licensing problems with the Sun 64 bit version I suggested in my own answer. Just out of curiosity: If you know a version which is available under ...

Jparsec - parsing simple numbers

Here's a simple piece of code: import org.codehaus.jparsec.Parser; import org.codehaus.jparsec.Terminals; import org.codehaus.jparsec.functors.Map; public class Test { static final Parser<Double> NUMBER = Terminals.DecimalLiteral.PARSER.map( new Map<String, Double>() { public Double map(String s){ return Double.valu...

How does URLConnection.setUseCaches() work in practice?

I have an Applet which is loading images over a http connection using URLConnection. I am setting setUseCaches(true) for all connections, but still not seeing any caching behavior. My image's HTTP headers have reasonable cache settings. If you look at bug 4528599 there is this rather mysterious statement: The current version (1.3.1) ...

Generic Interface takes self as Parameter. Recursive Generic?

Disclaimer: I don't have a whole ton of experience with Java Generics, but my colleagues and I just spent a solid hour trying to decipher an interface that was structured like this: Interface HasAttributes<a extends HasAttributes<a,b>, b extends HasAttributesType<b>> extends Identification<a> What exactly does it mean when an int...

Combined re-scaling and color reduction of an image in Java?

Given a rectangular input image I'd like to create an output image of size 40x40 pixels using a maximum of 10 colors. Hence, the two operatons needed are re-scaling and color reduction. The following ImageMagick command does the trick: convert input.png -scale 40x40 -colors 10 output.png How would you achieve the corresponding result...

Adding functionality: subclass vs decorator

I'm currently working on a legacy system using Oracle's ADF Faces JSF implementation for the presentation layer. The system relies on a rules engine to make certain form elements required, disabled, or even highlighted depending on the user's interaction with them or values entered. At it's current stage the application is "working", s...

Finite machine interpreter

I'm doing formal method and one of the project is to create a finite machine interpreter using java.it needs to read NFA from a text file and then convert from NFA to DFA. It also needs to output DFA to a text file.Then it goes to run through the symbol input and process DFA showing result whether accept or reject. I don't have much of ...

Why no SortedMultiset in Google Collections?

Google Collections contains the Multiset interface and the TreeMultiset class, but I was surprised to find that there is no corresponding SortedMultiset interface. Something like that would be very useful for modelling discrete probability distributions. Before I attempt to implement it myself, I would like to know if there is a speci...

Java Event Processing Framework

I'm looking for a lightweight framework that builds on top of the Process Manager pattern: http://www.eaipatterns.com/ProcessManager.html I'm specifically interested in using this for doing event processing whereby I'm interested in the success or failure outcome of a particular event and passing a message on to another "stage" based o...

Spring Security problem

I just installed Windows 7 with NetBeans 6.5.1 and JDK 6.16. I checked out our Webapplication project with SVN, which is working with spring security. Libraries are imported, no reference problems, the same configuration worked with XP. Here's the beginning of the exception: WebModule[/db3]PWC1275: Exception sending context initialized...

JDBC: best way to update a table?

let's say that i get a resultset which was queryed using joins from an sql database. is it better to use an sql statement to update the tables or insert new tuples/rows? or should i use the resultSet.update() function? i just want to know the drawbacks associated with each as well as the preferred method of updating tables. ...

Java; Runtime Interpretation; Strategies To Add Plugins

I'm beginning to start on my first large project. It will be a program very similar to Rosetta Stone. It will be a program, used for learning a foreign language, written in Java using Swing. In my program I plan on the user being able to select downloaded courses to learn from. I will be able to create an English course since I am a ...

A quick-switch alternative for HSQLDB file mode (I need concurrent access now)

I was happily working with HSQLDB by just having my DB URL like this: jdbc:hsqldb:file:target/testdb; ...and having everything like if I was on any other network database. Then suddenly one requirement punched me direct in the head, I need another JVM instance (in the same machine) to connect to the database to generate some reports....

Sun's Java Package Naming Convention: sun vs. com.sun

In JRE, Sun's internal packages are prefixed with 2 top-level domains (sun and com). For example, com.sun.security.jgss sun.security.jgss It seems pretty random to me which prefix they choose. I am curious what rules Sun uses for this. ...

Why was the name "Hibernate" chosen for Java's Hibernate library?

Does the term "hibernate" mean something specific with regard to ORM libraries? Is there a story behind it? ...

How do you call List.size() from a JSF 2.0 Facelets Template?

What is the syntax for calling list.size() in a JSF 2.0 Facelets template (eg, using an h:outputText element)? ...

Loading image in Java J2ME

Hi all, I have a problem with loading image with java 2ME. I have a image file "picture.png" in location drive "C:". After that I wrote my like this to show image from this location. Ex: import javax.microedition.midlet.; import javax.microedition.lcdui.; import java.io.*; public class ImageMidlet extends MIDlet implements CommandLis...

'Restore Defaults' Preference Page Functionality in Eclipse

Is there a programmatic method of achieving the same results as clicking 'Restore Defaults' in an Eclipse preference page? I already know how the field editor system works and preference storage works. Thanks! :) ...

How to get line number using scanner

I'm using scanner to read a text file line by line but then how to get line number since scanner iterates through each input?My program is something like this: s = new Scanner(new BufferedReader(new FileReader("input.txt"))); while (s.hasNext()) { System.out.print(s.next()); This works fine but for example: 1,2,3 3,4,5 I want to...

How to track cursor position efficiently in Java?

The effect I've been trying to create is that the mouse cursor icon changes whenever the mouse enters a certain zone on a JPanel, and switches to default whenever it leaves the zone. I'm using the MouseMoved feature in the MouseMotionListener class, which whenever the mouse moves over the JPanel verifies if the coordinates correspond to ...