texture obj file

I can place a texture on an object like a cube 2 ways.
1 is with UV map and just unpack an image. I can view it directly on screen but not when rendering

The other way is clicking on texture icon on right panel, loading a texure or textures in a slot (image or movie) and f12 to render.

I need to create an obj file with the texture loaded of course so what method do i pick to texture an object?

UV unwrap your object, add a material to it, add the texture (image texture not any built in procedural texture) to the material slot to influence Colour, with the mapping set to UV, you can then see the texture both when rendered and in the viewport and when you export the obj, the mtl file will reference the location of the texture.