How can I find the ports of a process in Linux? 

I tried:

```
netstat -a -p | grep'processID'

```

But if the process is not running, then there is no process ID and I am not able to get ports in this case. 

I am not running the process in any server, just a JVM instance which runs my Java process. 

Is there a way to find the port if its running, or will it be defined in any file then how to search?