java

javac error "code too large"??

I have a unit test where I have statically defined a quite large byte array (over 8000 bytes) as the byte data of a file I don't want to read every time I run my unit test. private static final byte[] FILE_DATA = new byte[] { 12,-2,123,................ } This compiles fine within Eclipse, but when compiling via Ant script I get the fo...

How do I interpret a WSDL with references to a namespace java: on a non-java client?

I'm trying to integrate against a SOAP web service, running on Apache Axis. The WSDL specifies a namespace with a URI, that looks like: <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:stns="java:dk.tdc.serviceproviderweb.datatypes" elementFormDefault="qualified" attributeFormDefault="qualified" targetNamespace="...

birt in a desktop application

Did someone ever used a birt report in a desktop application. I'm comming from the .net environment an there you can use crystal reports to show reports in desktop apps. Is this possible with birt too, without having to set up a server environment? Can you give me some advice how to reach this goal? thanks in advance. ...

Should we declare a public constructor when the class is declared as package private?

I think in this case there is no need to declare a public constructor since the class is not accessible outside the package anyway. But is there some hidden impact when the class has only package private constructor? ...

How to Force Thread Dump in Eclipse?

I'm launching a Weblogic application inside Eclipse via the BEA Weblogic Server v9.2 runtime environment. If this were running straight from the command-line, I'd do a ctrl-BREAK to force a thread dump. Is there a way to do it in Eclipse? ...

How do you format the body of a JMS text message?

Does everyone just use XML in the message? Are there any good alternatives to XML? If you do use XML, do you define an XML Schema so clients know how to send messages to your service? ...

New to Spring - BeanFactory vs ApplicationContext?

I'm pretty new to the Spring Framework, I've been playing around with it and putting a few samples apps together for the purposes of evaluating Spring MVC for use in an upcoming company project. So far I really like what I see in Spring MVC, seems very easy to use and encourages you to write classes that are very unit test-friendly. Jus...

Setting FetchMode in native Hibernate

I need to set the fetch mode on my hibernate mappings to be eager in some cases, and lazy in others. I have my default (set through the hbm file) as lazy="true". How do I override this setting in code? MyClass has a set defined of type MyClass2 for which I want to set the FetchMode to EAGER. Currently, I have something like: Session s ...

How to reliably get row index in JTable from MouseEvent ?

I want to find out at whih row of JTable the user clicked. How to do it ? ...

How best to implement user selectable variables in web application

I have a Java based web-application and a new requirement to allow Users to place variables into text fields that are replaced when a document or other output is produced. How have others gone about this? I was thinking of having a pre-defined set of variables such as : @BOOKING_NUMBER@ @INVOICE_NUMBER@ Then when a user enters some t...

how to disable dtd at runtime in java's xpath ?

I got dtd in file and I cant remove it. When i try to parse it in Java I get "Caused by: java.net.SocketException: Network is unreachable: connect", because its remote dtd. can I disable somehow dtd checking? ...

not strict xpath for java

do you know any not strict xpath for java? (I want it to not check dtd and schema) and it would be cool if it dont care about correct xml. ...

When should I use the java 5 method cast of Class?

Looking through some code I came across the following code trTuDocPackTypdBd.update(TrTuDocPackTypeDto.class.cast(packDto)); and I'd like to know if casting this way has any advantages over trTuDocPackTypdBd.update((TrTuDocPackTypeDto)packDto); I've asked the developer responsible and he said he used it because it was new (which d...

GZip HttpResponse using XSL Transformer - Java

I have the following code below in my Servlet, but when IE hits the page, it returns a blank html page. If I use the response.getOutputStream() directly in the StreamResult constructor, the page loads fine. What am I missing? response is an instance of HttpServletResponse and xsl is an instance of Transformer from XSLTC TransformerFac...

Sanitizing bad XML in Java

I'm using a third-party library that returns "XML" that is not valid, because it contains invalid characters, as well as non-declared entities. I need to use a Java XML parser to parse this XML, but it's choking. Is there a generic way to sanitize this XML so that it becomes valid? ...

What is the best "captcha" for use within a struts framework?

We need to integrate a good CAPTCHA into our CA Siteminder implementation. What is the best CAPTCHA for use with Struts? We've been looking at reCAPTCHA. ...

How to split a huge zip file into multiple volumes?

When I create a zip Archive via java.util.zip.*, is there a way to split the resulting archive in multiple volumes? Let's say my overall archive has a filesize of 24 MB and I want to split it into 3 files on a limit of 10 MB per file. Is there a zip API which has this feature? Or any other nice ways to achieve this? Thanks Thollsten ...

How do I tokenize input using Java's Scanner class and regular expressions?

Just for my own purposes, I'm trying to build a tokenizer in Java where I can define a regular grammar and have it tokenize input based on that. The StringTokenizer class is depracated, and I've found a couple functions in Scanner that hint towards what I want to do, but no luck yet. Anyone know a good way of going about this? ...

Library that subverts java access control and lets me access private member variables ?

Can anoyne recommend a good library that will let me easily read/write private member fields of a class? I was looking through apache commons, but couldnt see it. I must be getting blind ? Edit: Asking questions on the border of legalities always give these questions of "why"? I am writing several javarebel plugins for hotswapping class...

Resize an image in Java - Any Open Source Library ?

I need to resize PNG, JPeg and Gif files. Are there good java open source libraries to do that ? ...