java

Using FTP Proxy with apache commons-net

I want to set up an FTP connection using a proxy server with Apache's commons-net. But looking at this Does FTPClient support FTP connections through an FTP proxy server? has me worried. I have to meddle with the system properties and the Sun docs state that "If socksProxyHost is specified then all TCP sockets will use the SOCKS proxy ...

Tabbing over a JTable component

Hi All I have a panel containing a number of components, one of which is a JTable. When the JTable has focus and the TAB key is pressed, the default behaviour is to move focus from cell to cell within the table. I need to change this to focus on the next component instead i.e. leave the JTable completely. Ctrl-TAB achieves the desired ...

Scala as the new Java?

I just started exploring Scala in my free time. I have to say that so far I'm very impressed. Scala sits on top of the JVM, seamlessly integrates with existing Java code and has many features that Java doesn't. Beyond learning a new language, what's the downside to switching over to Scala? ...

SpringJUnit4ClassRunner tests -- work from ant, not from IDE

I have some tests that load up some Spring context files. When I run the tests from my ant target they work as expected. When I run them from IntelliJ I get a NotWritablePropertyException. I initially figured different classpaths, but the only differences are for IntelliJ's test runner. Caused by: org.springframework.beans.NotWritablePr...

Jfreechart help

Is it possible to draw a 3D chart using JfreeChart like in the following link.If possible can anyone give some hints and some snippets of code on what parameters of Plot can be used to do this. link text ...

Java: String representation of just the host, scheme, possibly port from servlet request

I work with different servers and configurations. What is the best java code approach for getting the scheme://host:[port if it is not port 80]. Here is some code I have used, but don't know if this is the best approach. (this is pseudo code) HttpServletRequest == request String serverName = request.getServerName().toLowerCase(); Str...

How to Calculate CRC8 in Java

I have a binary String of "011001000010100100100010001000100100100100", how do I calculate CRC8? Thanks ...

Poor performance by overriding Java class?

I have the following class subclass of FilterInputStream with only one method overrided. However the performance of this class is so poor. It performs at 1/10 the speed of its superclass. I even took the same source code from InputStream of javasrc and used it in my subclass. Same performance hit. Is there something wrong with overriding...

Reentrant locking.

A bit of help please, consider the bit of code below. public class Widget { public synchronized void doSomething() { ... } } public class LoggingWidget extends Widget { public synchronized void doSomething() { System.out.println(toString() + ": calling doSomething"); super.doSomething(); } } I ...

Example code archive using maven

The project is a library that contains the core library code, tests, and example code. At the end of the build process, the following archives should be created: xy-1.1.0-core.jar xy-1.1.0-tests.jar xy-1.1.0-examples.jar What is the best way to set this up with maven? Currently the setup is: src src/main/java src/examples/java src/t...

Weblogic Bea 10.0 M1 and WorkManager

Hi there! I have to execute long running threads in a WebLogic Bea 10.0 M1 server environment. I tried to use WorkManagers for this. Using an own WorkManager allows me to specify my own thread timeout (MaxThreadStuckTime) instead of adjusting the timeout for the whole business application. My setup is as follows: weblogic-ejb-jar.xml:...

for loop to interate over enum in Java?

I have an enum in Java for the cardinal & intermediate directions: public enum Direction { NORTH, NORTHEAST, EAST, SOUTHEAST, SOUTH, SOUTHWEST, WEST, NORTHWEST } How can I write a for loop that iterates through each of these enum values? ...

Convert arbitrary document to PDF using command line

I'm looking for a simple (free) way to convert an arbitrary document to a PDF from within a program. There are any number of free PDF printers, but I need to be able to call the conversion within a program without human intervention. The program is being developed in Java, but will run exclusively in a Windows environment so calling an ...

Java method override/interface problem

Hi all, I have interface FooI class FooA implements FooI class FooB implements FooI class FooC implements FooI I wrote a class "Handler" that has the following methods static double handle(FooA f) static double handle(FooB f) static double handle(FooI f) and I have a function like the following: void caller(FooI f) { Handler....

Runtime.exec() with absolute directory

I would like to use Runtime.exec() to initiate another process in a directory with spaces. (It sounds stupid but I really want to satisfy my curiosity) Details of the problem(simplified version) I have a myprogram.exe locates in C:/Program Files/MyProgram. What I observe: 1). when I call Runtime.exec("C://Program Files//MyProgram//mypr...

Defining the order of a list

Hi, I have the following problem. I have three classes, A, B and C. A contains a OneToMany relationed list of B:s. B contains a ManyToOne relation to C. C contains a field called "name" and B also contains a field called "name". What I'd like to accomplish is to have the items in A's list sorted primarily by C's name and secondarily by B...

Axis2 / JAX-WS error when unmarshalling xml file with large text elements

I'm completely stuck and need your help... I've created a webservice stub with jaxb 2.x for a service that sends a binary file (base64 encoded jpg images) within a soap message. Everything worked fine and I was able to receive and display the images, until I tried to export the eclipse RCP app to a product, which caused imediatly Linkage...

Unkown error when calling Java applet from JavaScript

Here's the JavaScript (on an aspx page): function WriteDocument(clientRef, system, branch, category, pdfXML) { AppletReturnValue = document.DocApplet.WriteDocument(clientRef, apmBROOMS, branch, category, pdfXML); if (AppletReturnValue.length > 0) { document.getElementById('pdfData').value = ""; CallServer...

Call C API from Groovy

I know that is better to use Python to call Posix and Win API, but I would like to know if there is a not so painful way to call C APIs from Groovy, or at least with Java. ...

Invoke method accepting multiple arguments with arguments array

I need to invoke a method without knowing a priori what will the amount of arguments be. I've tried using the member Method.invoke(Object, Object...) passing as second parameter an array of objects which contains my arguments, however that did not really work. Is there a way to do what I'm after? ...