Given your question is rather vague... here's my best answer:
- You need to find a way to connect to Core Service from Java. Either generate a proxy from the wsdl as documented here or use a pre-built one from the community
- Ask Tridion for a list of publications using the Core Service API, using something similar to thisthis
- Ask additional questions based on where you get stuck.