java

Found shared references to a collection org.hibernate.HibernateException

Hi, I got this error message : error: Found shared references to a collection: Person.relatedPersons when I tried to save addToRelatedPersons(anotherPerson) : person.addToRelatedPersons(anotherPerson); anotherPerson.addToRelatedPersons(person); anotherPerson.save(); person.save(); my domain : Person { static hasMany = [relatedPe...

what is meant by Business,System,Interface,Persistence classes?

what is meant by Business,System,Interface,Persistence classes? Explain me with some examples? ...

How to specify filepath in java?

I have created a java application for "Debian Linux." Now I want that that application reads a file placed in the directory where the jar file of that application is specified. So what to specify at the argument of the File Object? File fileToBeReaded = new File(...); What to specify as argument for the above statement to specify rela...

How to stop a java application?

I have made a java application and have packed it into an executable jar file. Now a user can start that program from either of the following two ways: Start if from command prompt by executing the following command on the command prompt: java -jar "MyJar.jar" By double clicking on that jar file. I want that my client would adopt se...

public static final variable in an imported java class

hi all, I happen to come across a Java code at my work place. Here's the scenario: There are 2 classes - ClassA and ClassB. ClassA has nothing except 4 public static final string values inside it. Its purpose is to use those values like ClassA.variable (don't ask me why, it's not my code). ClassB imports ClassA. I edited the string va...

Get started with QPID

Hello Could anyone share some links on how to get started using QPID? I have checked out http://qpid.apache.org/ and I have managed to start the Java QPID broker, but I don't know where to go from here. It would be great if someone had a sample app or two to use the broker and send messages to each other, in Java or C#. If not, maybe...

JBoss 5 truncates trailing = of a base64 cookie string

After upgrading from JBoss 4 to JBoss 5, I've noticed the most annoying regression. It truncates the trailing equal sign ('=') of a base64 cookie value. It took me so much time to understand that the problem wasn't my code but JBoss', I googled it and find out it's a known issue . The suggested work around is to calculate the string le...

Which framework to choose?

Hello there, I was thinking which framework would be a good choice to go into. I'm focusing on java apps and tested spring, grails and seam so far. I've also looked aboard java and gave ruby on rails a try too. In future I will be focusing on portlet development which I've gone through already without a complete framework (just hiberna...

Jar file of java

I have created a java application and packed it into a jar file on a Windows platform. Now I wants to deploy that jar file on Debian Linux. Will the same jar file work for Debian Linux? Is the command, used in windows for executing a jar file from the command prompt, same for Debain Linux? i.e. java -jvm "MyJar.jar" Will the above...

Eclipse Web Project Dependencies

This question is about eclipse development, I am trying to create a web application in Eclipse, the problem is that I don't get the the dependencies jars to the deployed archive. I've created a new dynamic web project and linked it to another java project. The java project references a few 3rd party jars (e.g. Spring jars) but for some ...

Splitting https between Apache and Game Server

Hi, i want to have both an Apache and a Game Server to be reachable on port 443 of the same IP address. The game server connection is a normal TCP connection that is established when the client logs in and stays open until the client logs out, perhaps hours later. At first I though about using mod_proxy in reversed mode and let the cl...

Which J2EE web development framework to choose for a simple, accessible application?

Hi everyone, I want to write a simple web application, on J2EE, with these characteristics: I don't need any AJAX, and it should even work with JavaScript disabled on the browser. It is a simple CRUD application I would need full control on the way each element is laid out on the page - no compromise on the GUI's look and feel. I can ...

Select all the components of a array without a loop

I've made a array full of JLabels and would like to add a listener to them. The listener doesn't need to know exactly which one was clicked on, just that one was. Is there a way to add the listener to the whole array instead of using a 'for()' loop ? Thanks for reading. ...

Java HTTP AUTH?

I'm trying to connect a desktop application I am writing with the del.icio.us api @ http://delicious.com/help/api and simply provide them with my username and password and to request an url to post a bookmark to my profile. The problem I have is that I don't understand how to send my login credentials when I open a connection. How woul...

Initializing program with files passed as main arguments (system.getProperty())

Hello, I have to execute my program with this line: java -DImport=data.txt -Din=input.dat -Dout=output1.dat main.Main I've been trying to figure it out how to do this but can't really get it working. I'm using Netbeans since I dont really get along with unix terminal classpaths and so on. public static void main(String[] args) { ...

How can I avoid OutOfMemoryErrors when using Commons FileUpload's DiskFileItem to upload large files?

I am getting OutOfMemoryErrors when uploading large (>300MB) files to a servlet utilizing Commons FileUpload 1.2.1. It seems odd, because the entire point of using DiskFileItem is to prevent the (possibly large) file from residing in memory. I am using the default size threshold of 10KB, so that's all that should ever be loaded into the ...

Recursion and permutations

Hi. Let's say that we have two boxes of pencils (in first box just blue and in second just red pencils). So the question now is, in how many ways can we put x red and y blue pencils in the line? Example: we have 3 Red pencils, and 1 Blue. Then we have 4 different ways. Combinations: BRRR, RBRR, RRBR, RRRB. So with 10 Red and 10 Blue ...

How is Java an 'imperative' programming language and not a 'declarative' one?

Specially in comparison to C/C++ (which are declarative), how is Java imperative? ...

How to implement connected rooms?

This may be a duplicate question as I don't know to phrase the search query. I'm creating a Zork-like text based game in Java where the character moves to different rooms which are connected to each other. I want to be able to list all options a player has available for this room. For example, Room A is connected east to B, and B is con...

Java Problem "UnsatisfiedLinkError"

I made a simple java program that sends bytes to the parallel port, which uses a .dll along with two other classes (pPort.java and ioPort.java) to accomplish it, and it works perfectly fine. However, I started making another program on NetBeans IDE which has a similar function. It compiles perfectly, but when I run it I get: Exception ...