java

Log4j for Message Driven Beans

So, here's my problem: I have a message driven bean X and would like to make use of Logger in X's onMessage() method. Lets presume that I have a single instance of the bean running in my app server, hence, I would initialize log4j in ejbCreate(). This would mean I would have to do something like this: public void ejbCreate() { Pr...

How many classes and packages do we have in java 6?

I would like to know the number of built in classes and packages that are available with Java 6. Please provide me the url from where this information is available. Thanks ...

Remote Debugging Java application

I have a java application running on linux machine. I run the java application using the following java myapp -Xdebug -Xrunjdwp:server=y, transport=dt_socket,address=4000, suspend=n I have opened port 4000 for tcp on this linux machine. I use eclipse from windows xp machine and try to connect to this application. I have opened the p...

order of parsed elements is lost in XMLBeans

I have a XML structure somewhat like this: <root> <a/> <b/> <b/> <a/> <a/> </root> My XSD looks like this: <xs:element name="root"> <xs:complexType> <xs:sequence> <xs:choice maxOccurs="unbounded"> <xs:element ref="a"/> <xs:element ref="b"/> </xs:c...

How can I use the java for each loop with custom classes?

I think most coders have used code like the following : ArrayList<String> myStringList = getStringList(); for(String str : myStringList) { doSomethingWith(str); } How can I take advantage of the for each loop with my own classes? Is there an interface I should be implementing? ...

Eclipse Error: "Failed to connect to remote VM"

I’m getting the following error when I start Debug from the Eclipse IDE. Message: “Failed to connect to remote VM. Connection Refused” What could be the reason? ...

Using Flex/Air with J2EE

Hi All, I work on a large financial system which is hosted on WebSphere and currently has an applet front end. I am just playing around with Flex for the first time and I am really impressed with the quality of the framework. I am interested to see if there is anyway I can integrate Flex into my J2EE application in a simple type safe ...

Books about how linking, compiling, etc and how it all fits together?

I'm having trouble understanding how compilers and linkers work and the files they create. More specifically, how do .cpp, .h, .lib, .dll, .o, .exe all work together? I am mostly interested in C++, but was also wondering about Java and C#. Any books/links would be appreciated! ...

How to create AES encryption and decryption program in symbian

I want to create AES encryption and decryption program in symbian which must be compatible with AES encryption in java Means if I encrypt the data in Symbian I must be able to decrypt the same in java and vice versa Thanks Sunil ...

help with null pointer exception in Java

I am putting together a simple simulated network in java, where i can add computers, servers, and connect two objects with ethernet ports. This is where the null pointer exception is being thrown, when i call "this.etherPort.addElement(t);" import java.util.Vector; public class Server extends Computer{ public Vector<E...

Conditional replacement with regex

Hi all, I'm a relative newb when it comes to regexes, but i'm starting to get the hang of it. I started writing a method in java to "linkify" a string - that is, scan it for any references of urls (i.e, "http://...") or strings that look like web addresses ("www.example.com...") So, for example, if I had a string that looked like this...

How to give cname forward support to saas software

I have a webapp where users can create their account and use the service. Now I want to give them a custom domain facility where app.customer1web.com points_to myservice.com with userid customer1 once he sets up the custom domain, for the world it looks like my service is running on his machine. Many services like blogger, wp.c...

Populate Collection from Struts2 Form Submission

I'm trying to populate a List of beans from a form: public class Foo { public String attr1; public String attr2; } public class Bar { public List<Foo> foos; } public class StrutsAction extends Action { public Bar bar; } So in my Struts2 form, what's the best way to populate Foo? Intuitively, I want to do: <input type="...

How to display system icon for a file in SWT?

I want to display a file tree similarly to java2s.com 'Create a lazy file tree', but include the actual system icons - especially for folders. SWT does not seem to offer this (Program API does not support folders), so I came up with the following: public Image getImage(File file) { ImageIcon systemIcon = (ImageIcon) FileSystemView.g...

how to impersonate a windows domain user for automated web testing?

we are about to build several UI test with selenium-rc and the java client the app itself is a classic asp web application that uses integrated security to retrieve the user's permissions from a database, and then, according to those permissions, displays a menu with the appropiate options. we'd like to automate that test, something li...

How can I use the eclipse indenter from my code?

I noticed the eclipse indenter has support for the latest version of java, and it would be nice if I could use that class to indent generated java source code. Is there a way of integrating it ? EDIT: I need to be able to include the code formatter in my code. No external calls. EDIT2: I've managed to get it working. You can read the s...

What compilers target JavaScript runtimes?

I am using GWT, which includes a Java-to-JavaScript compiler. Before this project, targeting the JavaScript runtime from a different language hadn't occurred to me, and I'm enjoying the GWT experience. A quick search revealed Java2Script as another Java-to-JavaScript solution. Are there any other mature compilers that target the JavaS...

A better way to manage debug messages in general ?

Hi, that may be a dumb question... but I have a quite large java program that i'm debugging using the old System.err.println method, like I do using print* in any other language... But after a while, I've so many of them, I don't know how to manage them (and sometimes I put twice the same message concatenated with other information mak...

Low-hanging graphics programming fruits?

Hi, I'm currently working on a tile-based game in Java2D, and I was thinking of adding some cheap eye candy. For example, implementing a simple particle system (maybe something like this) for explosions and/or smoke. Do you have any suggestion for relatively easy to program effects that wouldn't require drawing a lot (or at all) of ...

Domain Driven Design, Containing Entities and NHibernate Persistence

In my domain driven design I have a containing entity, say Car, which has a list of constituent entities, e.g. Wheel. Now, I want to add a ChangeWheel method to my car entity. Note that changing the wheel does not actually modify the car entity as such. It only affects one of the entites in its wheel collection. I.e. the Car entity h...