Why not all coast

gmt begin japan png
gmt coast -RJP -N1 > N1JP
gmt end show

Picture of coast is not full

gmt begin japan png
gmt coast -RJP -W > N1JP
gmt end show

Exit file is empty

In modern mode, you don’t have to pipe output into a file (i.e. remove > N1JP).

I don’t know about the coastline.

gmt begin japan png
gmt coast -RJP -N1 > N1JP
gmt end show

Picture of coast is not full

It’s because the -N1 option plots national boundaries using the GSHHG data. I can’t find it in the documentation, but I remember the GSHHG data only contains national boundaries for a few countries, like US and China.

gmt begin japan png
gmt coast -RJP -W > N1JP
gmt end show

Exit file is empty

If you want to dump the coast line or boundary data, you should use -M option.

Back to your initial question, if you want to plot Japan national boundary, you should use -E option, which uses the DCW data, rather than the GSHHG data. The following script works:

gmt begin japan png
gmt coast -RJP -EJP+p1p 
gmt end show

Thanks a lot.
But I need text file with
coordinates of the cost to select
later seismic events , which are near the coast line.
Your sample does picture. When I add a >> textoutcoast
I see blank file
I work under window last version of GMT

As mentioned in you previous response, you need to use -M option:

gmt coast -RJP -EJP -M

This line gives error-
no input file allowed

It works well for me. You may have some typos.

The error JP is not recognised as
supported format
I took your sample into clip board

Maybe you are copying-pasteing some bad formatted hyphens. The command @seisman posted is correct and works fine.

The following lines gives me error -
JP format is not supported

gmt begin japan
gmt coast -RJP -EJP -M
gmt end show

or
gmt begin japan
gmt coast -RJP -EJP -M > result
gmt end show

Some miricle
I wrote
gmt begin tur
gmt coast -RTR -ETR+p1p -M >tur
gmt end show
IU worked fine
Came back to Japan
and now it works fine
gmt begin japan1
gmt coast -RJP -EJP+p1p -M >jap
gmt end show

You should not use gmt begin ... gmt end here. That’s for plotting only and you are not plotting anything.