Javelin of Lightning doesn't enter the battlefield attached to a creature. Instead, the Equipment enters the battlefield and then a triggered ability attaches it to a creature. You may cast Javelin of Lightning even if you don't control any creatures.

Artwork
Loading artwork…
Javelin of Lightning
Commander Legends: Battle for Baldur's Gate · #185 · EN
Nonfoil—Foil—
Card rules
Flash
When this Equipment enters, attach it to target creature you control.
During your turn, equipped creature gets +2/+0 and has first strike.
Equip 4 (4: Attach to target creature you control. Equip only as a sorcery.)
Common · Illustrated by James Paick
Format legality
Commander Legal
Duel Legal
Legacy Legal
Oathbreaker Legal
Pauper Legal
Pauper Commander Legal
Tlr Legal
Vintage Legal
Alchemy Not Legal
Brawl Not Legal
Competitive Brawl Not Legal
Future Not Legal
Gladiator Not Legal
Historic Not Legal
Modern Not Legal
Old School Not Legal
Penny Not Legal
Pioneer Not Legal
PreDH Not Legal
Premodern Not Legal
Standard Not Legal
Standard Brawl Not Legal
Timeless Not Legal
Rulings
Published rulings from the downloaded Scryfall catalog. Source card record · Rules and interactions
Attaching an Equipment with its enters-the-battlefield triggered ability isn't the same as using its equip ability. You don't pay mana for the attachment, and the timing restrictions for equip abilities don't apply.
If the target creature becomes an illegal target, the Equipment remains on the battlefield unattached.