java

SWT: Unable to resize buttons on a Mac

I am developing a Java application using SWT that contains some buttons with images. On my Windows machine, the button will automatically be large enough to show the entire image in the button. I tried this on a Mac however the button will not become tall enough to fit the entire image. I tried using the setsize() function on the bu...

Does int have a max and min value in a SOAP web service?

If I specify a parameter in my WSDL is of type xsd:int, what is the max and min values for that parameter? It is dependant on the technology the web service is implemented in? I am using Java, so am I constrained by the int type in Java or should the web service library (Axis) be handling that? ...

List files inside a jar

I have this code which reads all the files from a directory. File textFolder = new File("text_directory"); File [] texFiles = textFolder.listFiles( new FileFilter() { public boolean accept( File file ) { return file.getName().endsWith(".txt"); } }); Works great. It fills the array with...

Calling Java code from a C# COM DLL that’s used by a WIN32 application?

I have a very simple problem. I have an application which is written in Delphi 2007 for WIN32. It uses a C# DLL which is imported into the project through it's COM interface and a simple trick to avoid registering the COM object. But now I have a Java-generated .JAR file that I want to call from my application. And while I have access to...

Java application interacting with the command line.

I am thinking of writing a java application to wrap CVS and some of our other custom build/deploy scripts. This way it will be easy to view status, do a build, publish and deploy without having to type in the commands. What is the easiest way to do this? Offhand I'd guess I have to redirect the output from the command to a String an...

What are Groovy/Grails/Hibernate/JBoss/Jade in very simple terms?

I am new to Java. Its only been six months but I do understand Java. While reading about it sometimes, I come across these terms - Groovy, Grails, Hibernate, JBoss, Jade and many more. I know I can read all about them individually. But can somebody give me a treetop view of what is happening here? What is all this? We have Java and th...

Enum "does not have a no-arg default constructor" with Jaxb and cxf

A client is having an issue running java2ws on some of their code, which uses & extends classes that are consumed from my SOAP web services. Confused yet? :) I'm exposing a SOAP web service (JBoss5, Java 6). Someone is consuming that web service with Axis1 and creating a jar out of it with the data types and client stubs. They are then ...

Can Java methods return type Enum?

I could be wrong but I'm guessing from this previous SO post that, since an enum in Java cannot be declared locally, that therefore it is therefore problematic for a method to return type Enum? I can declare that a method should return an Enum (see below) but how would one then go about implementing such a method to return anything othe...

Prevent System.exit in a Groovy web console without security policy file

We have an admin debug console in our app that lets you enter a script and submit it to get the result back. We're not worried about malicious users, but would like to prevent basic stuff like someone entering System.exit(1) just to see what it does. Unfortunately, adding a security policy file isn't an option. Is there any other way to...

Log4j filtering per logger, based on Event

I would like to filter log events coming from a specific component of a 3rd party library, based on the content of the log message. I only want this filtering to be applied when the log event is generated by a specific logger: "org.restlet.Component.LogService". The filtering itself is just a basic match against the log event message. I...

What happens when Swing's threading policy is violated?

In the past few years I've mostly done UI development in Eclipse, which is very conservative in terms of thread access: any attempt to change a property on a UI widget (e.g., color, text) from outside the UI thread throws an exception. I am now looking at an existing program in Swing that has a window with a large number of custom widge...

What is the most elegant solution to managing various Java external libraries?

Perhaps the reason I stalled learning Java until now is because I HATE how Java handles external libraries. I'm stuck keeping them in one place, adding them individually, fixing problems with versioning and every time I move/rename them, and copying and writing the classpath over and over each time I release a Java application. There ha...

Command Objects in Spring

I have a command object composed of primitive fields and an object field. How do I bind my form fields to the fields in the object? I tried doing this but to no avail <form:form commandName="course" method="POST"> <form:input path="activity.activity"/> . . . </form:form> I get this error org.springfr...

Easiest way to convert a List to a Set? - Java

Easiest way to convert a List to a Set? - In Java ...

Guice-style service locator

Has anybody ever seen/attempted to write a service locator pattern which uses a Guice style configuration system? Currently I have a GWT project (which happens to use GWT-RPC) that uses a command pattern wherein my RPC servlet that looks like this... public interface TransactionService extends RemoteService { <T extends Response> ...

HttpURLConnection in android doesn't send correct User-Agent header

Hello, I have found an issue. I have a server that uses User Agent header to identify the device that is connecting to it. But when i connect to the server using HttpURLConnection i get no User Agent header, but when i connect with the browser it sends the correct User Agent. For testing i am using an echo server that replies with the ...

JasperReports rendering problem

I have a very weird JasperReports rendering problem. I am using an old version of the free Java Reporting Tool JasperReports: 1.3.4. It's being heavily used on a Swing finance application. I use JasperViever class to show a preview of the report to print, and my weird problem is that the report shows perfectly fine on some computers wh...

A tool for converting database tables to entity java classes for hibernate

Hi; I need a tool for converting database tables to entity java files for hibernate. There are 20 tables (mysql) and I don't want to copy table's column name to my Java file and so on. Any suggestions ? Thanks. ...

Mule/Jetty Setup

I have a working Mule application that I want to setup Jetty on to respond to http requests. The following config: <jetty:endpoint address="http://localhost:8080" name="jettyEndpoint" host="localhost" port="8080" path="/" synchronous="true" /> <service name="jettyUMO...

How to determine what classes have been loaded from where in JBoss

I seem to remember some function in the JMX console which allows you to type in a class name, and see the classloaders which loaded it, and from which resources the class was loaded from. Unfortunately, I can't seem to find this. For standalone apps, I've always used the JWhich tool to get this information. ...