java

How to pass arbitrary object within Fitnesse page?

Hi, I need to pass an object (my own business object) between two tables in one page. The value is got from the getter call in one fixture and then should be used as field in another fixture (both ColumnFixtures). Please note that the object to be passed is neither primitive nor String and the conversion is not that simple. Is it even po...

Scala/Lift question rss feed fetch

I'm looking for a simple line or two of code that will grab an rss feed like this php line: $feed = "URL" from within a scala object. I'm using scala/lift with Netbeans or Eclipse if it's relevant ...

Implementing service-level authorization with WS-Security

I am implementing WS-Security using WSS4J and I'm trying to incorporate some support form of authorization. I have a global handler, defined in the <requestFlow>, which executes before every service. I need to determine, through the Axis MessageContext or otherwise, what class is mapped to the requested service. I want to delegate to ...

PaintComponent Takes a Long Time, Ties up the Swing Event Dispatch Thread

I've customized a JPanel that displays a large, complicated diagram. Depending on the size of the data, it can take a few minutes to render in paintComponent(). I'm looking for a strategy to: draw the component without tying up the event dispatch thread. draw something in the JPanel to let the user know the image is being rendered. pe...

how to get variable names at runtime?

The use case is this: public void testMethod(String para1, String para2, String para3){ if(para1==null){ System.out.println("para1 cannot be null"); } if(para2)... } As the check null code above, we will be repeating ourselvous on writing the same code to check every parameter. But we cannot really factor out a common...

StackOverFlow error - from instantiating my object class

I am trying to make a class in Java that builds an object of type Action which holds three ints and returns it to my other class in the array history, where history is an array of type Action. When it is called I immediately get an endless loop; hence the stack overflow. Error - I printed 1 line, it goes on... Exception in thread "main...

How do I work with a Canvas / JCanvas in Netbeans

In netbeans it is possible to add a canvas to your app, however it does not seem possible to draw on the canvas because you need to overload the paint(Graphics) method. What is the best way to do this? Thanks! ...

Java - PDF Generation Framework

I am using PDF documents for various purposes using iText library. Its like once class per PDF document. In a way there are a lot of similarities among the classes and the same have been listed below: The fields have (x,y) location The field can be wrapped after some no. of words A field can have a value which is a function of one or ...

Java hashcode based on identity

The default behavior of Object.hashCode() is to return essentially the "address" of the object so that a.hashCode() == b.hashCode() if and only if a == b. How can I get this behavior in a user-defined class if a superclass already defines hashCode()? For instance: class A { public int hashCode() { return 0; } } class B extends...

Resolve message from property file

How can we resolve a message from properties file? Just like when we use errors.reject ( "xyz.abc" ); in this case "xyz.abc" is resolved from the property file specified in messageResource ( servlet.xml ) ...

what does each of these options mean?

java -Djava.library.path=../lib -classpath ../lib/wrappertest.jar:../lib/wrapper.jar:Service.jar:../lib/mysql-connector-java-3.0.17-ga-bin.jar -Dwrapper.key=Ksxtsmvr7iAmVJ-T -Dwrapper.port=32001 -Dwrapper.jvm.port.min=31000 -Dwrapper.jvm.port.max=31999 -Dwrapper.pid=1731 -Dwrapper.version=3.3.0 -...

Ant can't find Javac. No matter what I do it always claims JAVA_HOME is "C:\Program Files\Java\jre6"

...and that's wrong. Here's the error I get: BUILD FAILED C:_TraderPlatform\Clients\Open\Open\Java\Applets\PPDataTransporter\nbproject\build-impl.xml:338: The following error occurred while executing this line: C:_TraderPlatform\Clients\Open\Open\Java\Applets\PPDataTransporter\nbproject\build-impl.xml:158: Unable to find a javac compil...

Where do I find a good, short, architecture-oriented introduction to Java Swing GUI for web developerrs?

I'm just starting my first Java Swing project(doing mainly web-based apps before) and try to understand how to build a proper architecture with separation of concerns between the MVC components. Just about any documentation I find goes very deep into the details of how each and every Swing UI widget works and can be used, but all exampl...

Java - Generic ChangeListener

Scenario: I have a container object which holds a mixed bag of objects all inheriting from the MyContainedObject class. Consumers of the container class do not have direct access to contained objects, but my be interested in knowing when they change. Design Decision: What's the best way to listen for ChangeEvents on a specific class ...

How to combine multiple Excel files into single Excel workbook with multiple sheets?

I need to develop a service (either WCF or Java) that can take multiple single-sheet Excel files and combine them into a single Excel workbook with multiple sheets. The Excel files are actually exported from crystal reports as individual files. Following are some of the requirements of the service: 1) Should preserve all the formatting...

Sharing Static Data Outside of the Class

Hello. First, here is a motivating example: public class Algorithm { public static void compute(Data data) { List<Task> tasks = new LinkedList<Task>(); Client client = new Client(); int totalTasks = 10; for(int i = 0; i < totalTasks; i++) tasks.add(new Task(data)); client.submit(tasks); } }...

How can I compile and deploy a java class at runtime?

Hi all, I am in the process of writing a rule engine that performs simple assignments as determined by conditional constructs. It is a prerequisite of the project that the rules be in XML format. I have modeled my XML schema to resemble simple code blocks. I wish to parse the XML and to then transform it into Java code. I then wish to c...

Newbie question: how to include JAR files when compiling?

I have the following in a java file (MyRtmpClient.java): import org.apache.mina.common.ByteBuffer; and ByteBuffer is inside a JAR file (with the proper directory structure of course). That jar file and others I need are in the same directory as the .java file. Then I compile with the line: javac -cp ".;*.jar" MyRtmpClient.java But...

Output from anonymous classes?

How can I get output from Java anonymous classes? In .Net I would use closures. executor = Executors.newSingleThreadExecutor(); final Runnable runnable = new Runnable() { public Exception exception; @Override public void run() { try { doSomething(); } catch (Exception exception) { // I'd like to report thi...

Pdf to Swf conversion using Java

Does anybody know a Java tool that can convert a pdf file to a swf file ? To clarify, we are building a site to generate photo albums. The photo album editor is written in Flash (ActionScript 3.0) and then on the back-end is written in Java and it generates a pdf for the album. The problem is having two rendering engines (Flash for clie...