java

Where to tweak an Eclipse to change the default settings used when creating a new Workspace?

We use Eclipse with projects in CVS. It has proven to be the simplest to create a new workspace when having to deal with another branch or application, and then use Team -> Import project set to get all the needed projects from CVS. Unfortunately, I then have to do the following each and every time: Change text font to Consolas 11 pt...

Draw a rectangle in an iText pdf

Is there a way in iText (the java version) to draw a rectangle into a pdf document? ...

run: java.net.ConnectException: Connection timed out: connect BUILD SUCCESSFUL (total time: 23 seconds)

Hi, I'm very new to Java few days but i'm trying to get things working. I'm getting this error as a result. Basically i should create a package to safe the results from the URL to a specific location and it should safe it as XML file. run: java.net.ConnectException: Connection timed out: connect BUILD SUCCESSFUL (total time: 23 seconds)...

Most elegant way to extract data from multiple lists into a new one in Java?

This may be a little subjective, but I have often found that it can be very interesting to see how other developers approach certain daily details. I have code which works like this: class A { public List<SomeType> getOneSet() { ... } public List<SomeType> getAnotherSet() { ... } } class B { public static OtherType convert...

How do I configure eclipse classpath used for junit tests?

I have an eclipse project where every source folder has its own associated output folder. Instead of /classes it's called /eclipse-classes. So if I have a folder: src/main/java (typical maven thing) the target folder is: target/eclipse-classes And likewise for resources etc. This seems to work (i.e. eclipse generates .class files tha...

How do I autoident in Netbeans?

In eclipse you can click Ctrl+I at any line, and it'll automatically indent the line or group of lines according to the indentation scheme you chose in the settings. I'm really missing this feature in Netbeans. Is there any equivalent feature? I'm aware of Alt+Shift+F but it's not good enough. I want to indent a group of lines, and not...

Help with creating a new JAXB instance in Oracle enterprise manager

When trying to create a new JAXB instance inside a servlet I am getting a JAXBException saying the jaxb.properties cannot be found. I have been trying to explicitly pass the classloader with the call to JAXBContext.newInstance() but I cannot figure it out. Here are the class loaders: servlet classloader: oc4j:10.1.3 servlet paren...

In Java, why do Exception classes need to be available to the classloader before they're necessary?

I'm developing an application that dynamically loads a JAR, which contains the definition of a bunch of classes it uses. Everything went fine until I tried to catch an Exception-derived class that's in the dynamically loaded JAR. The following snippet shows the issue (DynamicJarLoader is the class which actually loads the JAR; both Test...

Is Culture in C# equivalent to Locale in Java?

C# uses the concept of Culture. Is this operationally similar to Locale in Java or are there significant differences in the underlying concepts? ...

CRM Ondemand Integration Events queue

I've been using the Integration Events web service, for not that much, and i was wondering if there is an elegant way to manage the queue. I changed the integration event wsdl, to fit my needs, but i don't know what value i need to set in the xml for the EventCount to make it not required. Thanxs in advance. ...

Enum with Generics

UPDATE: Disregard this question. I had an inadvertent import in my abstract class that was the same name as COLUMNS... Someone please delete. I'm encountering a weird issue with Generics and Enum. Here are the relevant code: public abstract class AbstractModel<E extends Enum<? extends E>> { protected abstract Object getValue(in...

Integrating Spring 2.5 with Ibatis 3

Does anyone know of a way to integrate the new Ibatis with the current Spring 2.5? I'm exploring pulling it in to a project and was curious if anyone had done it before. ...

Pulling values from a Java Properties file in order?

I have a properties file where the order of the values is important. I want to be able to iterate through the properties file and output the values based on the order of the original file. However, since the Properties file is backed by, correct me if I'm wrong, a Map that does not maintain insertion order, the iterator returns the val...

Efficient XSLT pipeline in Java (or redirecting Results to Sources)

I have a series of XSL 2.0 stylesheets that feed into each other, i.e. the output of stylesheet A feeds B feeds C. What is the most efficient way of doing this? The question rephrased is: how can one efficiently route the output of one transformation into another. Here's my first attempt: @Override public void transform(Source data, ...

How to select text in JtextField while tabbing

I have a JDialog with a series of JTextFields on it I would like the text each to be selected when I tab to it. ...

Hibernate Exception Fixed By Alt+Tab

Hi all, I've got a very curious problem in Hibernate that I would like some opinions on. In my code if I do the following: Go to page A Click a link on page A to be taken to page B Click on data item on page B Exception thrown I get an error telling me: failed to lazily initialize a collection of role: XYZ, no session or session w...

What could go wrong with calling a static method with an object in Java?

If I have the following: class A { public A() { } public static void foo() { System.out.println("foo() called"); } } public class Main { public static void main(String [] args) { A a = new A(); a.foo(); // <-- static call using an instance. A.foo(); // <-- static call using class } } Are there any problems that ma...

log4j with third-party-initialized JVM, multiple JAR files and Jython

I have a mess I would like to attach log4j logging to. Let me try to explain the process. Third-party application launches a JVM and loads Main.jar. Main.jar includes a properties file for log4j logging and code to read it in with a PropertyConfigurator. Logging in Main.jar works. Later, third-party application loads JythonApp.jar. Jyt...

Beginner java question

I am taking an intro to programming online. However, I am stuck on one assignment. The assignment is to write a breakout game. I have succesfully written 97% of the game. However, the game stops before all the bricks are removed. Sometimes there are 4 bricks remaining, some times 11. The program is designed to stop when the score counte...

Java - Image encoding in XML

Hi everyone, I thought I would find a solution to this problem relatively easily, but here I am calling upon the help from ye gods to pull me out of this conundrum. So, I've got an image and I want to store it in an XML document using Java. I have previously achieved this in VisualBasic by saving the image to a stream, converting the s...