In order to have a current in a long wire, it should be connected to a battery or some such device. Can we obtain the magnetic field due to a straight, long wire by using Ampere’s law without mentioning this other part of the circuit?

We can always find the magnetic field due to a long, straight current carrying wire along any loop which only contains that wire by using Ampere’s circuital law. The law only takes into account the current bound in the loop irrespective of the source. If we take the whole circuit along with the battery within that Amperian loop, then the total current contained in that loop will be zero so the resultant magnetic field will be zero too even if the wire itself produces a non zero magnetic field.


1