Im writing a java system for some one, and no contract has been established so far.
Im just wondering, if i dont sign any contract, to whom does the source code of my project belong to?
Is it mine? do i sell it to him? does he just get it? how does that work?
Thanks!

It depends on your agreement, but traditionally, it will belong to the customer.
...if it was their idea to have it done.

Will you always be their developer?
Will you benefit from keeping the code forever?

If you made the product before ever meeting the customer, it would be different.

other possibilities: whose machine did you write it on, are you using code/libraries from him (or another third partie), is this for your work, for a potential employer, for a course you're taking, .. ?

here:
"Im writing a java system for some one, and no contract has been established so far."
you are contradicting yourself. you are writing an application for someone, which means: someone asked you to do so, and you agreed. <- that asking and agreeing might be considered a contract. it may be more difficult to prove. I'm just basing myself on our legal system here( not knowing where you are from and where your client/employer is from ).

is there a compensation of some sort agreed on upon completion of the project?
there's a lot you must consider before you can truly answer that question.

Find out what you are being paid for;
1. To code on their equipment (by the hour) - Source belongs to the client
2. Deliver an executable (*.class files) - Source belongs to you
3. Deliver source code (*.java files) - Source belongs to the client

ahh oky well that makes allot of sence.
Yes i work on his machine, and do get compensation by the hour for the work i do.
Thank you. That really answered my question

Of course, there is nothing stopping you from taking a copy of the code for yourself.
However, you MUST modify it to perform a little differently, to call it yours.
I do it all of the time.
I take the code that I write for my clients and make it more efficient, easier to use, and more generic (reusable).

This question has already been answered. Start a new discussion instead.