You file 1040 NR as a visiting scholar on J1 Visa.
You are considered a nonresident during the first two years since you entered the US.
After that, you are considered a resident if you are in the USA for more than 183 days and file a resident tax return, form 1040).
You can claim exemption from paying taxes if there is a tax treaty between the USA and your country.
Tax Treaty