java

iterating over Enum constants in JSP

Hi, I have an Enum like this package com.example; public enum CoverageEnum { COUNTRY, REGIONAL, COUNTY } I would like to iterate over these constants in JSP without using scriptlet code. I know I can do it with scriptlet code like this: <c:forEach var="type" items="<%= com.example.CoverageEnum.values() %>"> ${type}...

Another JPA Question

I have this code: @PersistenceContext(name="persistence/monkey", unitName="deltaflow-pu") ... @Stateless public class GahBean implements GahRemote { But when I use this: try{ InitialContext ic = new InitialContext(); System.out.println("Pissing me off * " + ic.lookup("java:comp/env/persistent/monkey")); Iterator e = ic.getEnvironm...

Java Web Deployment: build code, or deploy .war?

Two main ways to deploy a J2EE/Java Web app (in a very simplistic sense): Deploy assembled artifacts to production box Here, we create the .war (or whatever) elsewhere, configure it for production (possibly creating numerous artifacts for numerous boxes) and place the resulting artifacts on the production servers. Pros: No dev tools ...

OC4J 10.1.3.4 problem with deploying multiple 2.1 EJBs

I am having troubles migrating from OC4J 10.1.2.3 to 10.1.3.1.4. The problem is for applications that have multiple EJBs (all are 2.1, no EJB 3.0). Jdeveloper will take the default ejb-jar.xml (the one required for Jdeveloper to run it on its stand-alone OC4J instance) and package it into each EJB JAR module NO MATTER what. This results...

What is the default session timeout for a Java EE website?

If I do not specify the following in my web.xml file: <session-config> <session-timeout>600</session-timeout> </session-config> What will be my default session timeout? (I am running Tomcat 6.0) ...

Java, unicode and fonts

I've looked at the java documentation and scoured the net for information on java's support for international characters with specific fonts (such as Monospace), but haven't been able to get a clear concrete answer. There has been a change between java 1.4 and java 1.5/1.6. For example, in java 1.4 if you set the font on a JTextArea to ...

Tokenizers in .NET

This must be a classic .NET question for anyone migrating from Java. .NET does not seem to have a direct equivalent to java.io.StreamTokenizer, however the JLCA provides a SupportClass that attempts to implement it. I believe the JLCA also provides a Tokenizer SupportClass that takes a String as the source, which I thought a StreamTo...

Buffer a large file; BufferedInputStream limited to 2gb; Arrays limited to 2^31 bytes

I am sequentially processing a large file and I'd like to keep a large chunk of it in memory, 16gb ram available on a 64 bit system. A quick and dirty way is to do this, is simply wrap the input stream into a buffered input stream, unfortunately, this only gives me a 2gb buffer. I'd like to have more of it in memory, what alternatives d...

Best way to compare 2 XML documents in Java

I'm trying to write an automated test of an application that basically translates a custom message format into an XML message and sends it out the other end. I've got a good set of input/output message pairs so all I need to do is send the input messages in and listen for the XML message to come out the other end. When it comes time to...

How do I locate resources on the classpath in java? Specifically stuff that ends in .hbm.xml

How do I locate resources on the classpath in java? Specifically stuff that ends in .hbm.xml. My goal is to get a List of all resources on the classpath that end with ".hbm.xml". ...

Sending the same but modifed object over ObjectOutputStream

I have the following code that shows either a bug or a misunderstanding on my part. I sent the same list, but modified over an ObjectOutputStream. Once as [0] and other as [1]. But when I read it, I get [0] twice. I think this is caused by the fact that I am sending over the same object and ObjectOutputStream must be caching them som...

How to stop Eclipse 3.4 losing reference to the JRE in projects

Sometimes when using eclipse it loses references to the JRE. i.e. It cannot find classes like Object or Arraylist. Some projects report a problem while others don't and they both use the same JRE. I have found that if you switch the installed JRE to another and then back again to the one you want to use, it will then work again Is th...

Java: Enum parameter in method

Hi guys, I have a method lets say: private static String drawCellValue(int maxCellLength, String cellValue, String align) { } and as you can notice, I have a parameter called align. Inside this method I'm going to have some if condition on whether the value is a 'left' or 'right'.. setting the parameter as String, obviously I can pass...

How do you establish context and call an WebSphere EJB from the Sun JRE (not IBM)

Is there a way to call an EJB that is served through WebSphere (iiop://host:port/ejbName) from a vanilla JRE (like Sun). A lot of people have been telling me that this type of architecture relies in a homogenous environment. Thoughts? ...

Eclipse: Dependency Management

What are some methods of utilising Eclipse for Dependency Management? ...

Tomcat deployment

Is there a way, given a war file, to deploy on a tomcat server. I want to do this without having to use the web interface. ...

What software would you recommend for image enhancement prior to OCR (Optical Character Recognition)?

We are currently researching ways of enhancing image quality prior to submission to OCR. The OCR engine we are currently utilizing is the Scansoft API from Nuance (v15). We were researching the Lead Tools but have since decided to look elsewhere. The licensing costs associated with Lead Tools is just too great. To start with we are l...

Splitting log4j Output with Quartz Worker Threads

I'm working on an application that consists of an overall Quartz-based scheduler and "CycledJob" run using CronTriggers. The purpose of the application is to process inputs from different email inboxes based on the source country. Based on the country that it comes in from (i.e. US, UK, FR, etc.) the application triggers one job thread...

How do I import a pre-existing Java project into Eclipse and get up and running?

I've been a C++ programmer for quite a while but I'm new to Java and new to Eclipse. I want to use the touch graph "Graph Layout" code to visualize some data I'm working with. This code is organized like this: ./com ./com/touchgraph ./com/touchgraph/graphlayout ./com/touchgraph/graphlayout/Edge.java ./com/touchgraph/graphlayout/GLPane...

Handling context-path refs when migrating "/" site to Java EE packaging

An existing Java site is designed to run under "/" on tomcat and there are many specific references to fixed absolute paths like "/dir/dir/page". Want to migrate this to Java EE packaging, where the site will need to run under a context-root e.g. "/dir/dir/page" becomes "/my-context-root/dir/dir/page" Now, the context-root can be easil...