ssh example.com somecommand doesn't read your
somecommand is executed directly by the ssh daemon. When you don't specify a command, the ssh daemon invokes your login shell, which reads your
~/.login depending on your login shell.)
There are a few ways to set environment variables for a non-interactive command, but they all require a setting in the server configuration which is typically off by default. Assuming a recent enough OpenSSH on both sides:
You can have environment variables sent from the client to the server with the
SendEnv directive in
~/.ssh/config. The specific environment variable must be enabled with an
AcceptEnv directive in the server configuration.
You can set environment variables through
~/.ssh/environment on the server side. This must be enabled in the server configuration with the
Assuming you use key-based authentication, you can also set per-origin variables in
environment="FOO=bar" at the beginning of the relevant line. Again, you need the
PermitUserEnvironment directive in the server configuration.
If you can't or don't want to change the server configuration, you'll have to write the full path to the remote command, or explicitly source your
.profile in the remote command.
ssh firstname.lastname@example.org -Y '. ~/.profile; netbeans'
ssh email@example.com -Y '/path/to/netbeans'