It depends on the complexity on your sentences. If you have a limited range, you could do simple pattern matching on part-of-speech tags. Put your sentence through a tagger (there are plenty of them around) and look for the first noun following a verb:
I want an apple
Pronoun verb determiner noun
(I assume you mean the object, as the subject in that sentence would be I). Scan through the list until you hit a verb, then pick the next noun. This should work for most English sentences.
It gets a bit more complicated if your nouns have additional words around them, for example red apple (where red is an adjective) or bottle of beer (where you have the pattern
noun OF noun). So if you want to capture those fully, you might need a few more complex matching rules.
Overall it should still be a lot easier than implementing a full-blown syntactic parser which creates a comprehensive structural analysis of your sentence, most of which you wouldn't need in the first place.