No. It's better to use "with a" instead of "having" in the top sentence. "With" on its own is incorrect, according to Grammarly:
An article (a, an, or the) is a type of determiner. Possessive adjectives (my, his, our), possessive nouns (Joe’s, mother’s), and quantifiers (each, every) are also determiners. Single countable nouns usually require a determiner.
Since "weight" is a single countable noun, it's best to put an article in front of it when using "with" or "having".
This often happens when someone is attempting to reduce the number of words in their work. For example, I made this up, which is grammatically incorrect but still understandable:
Grab key. Go to car. Unlock with third button. Open door. Get in car. Close door.
Your second sentence is fine; it doesn't matter if you use "having a" or "with a", though I would recommend "with a" because more people will understand it.