There are two methods. These only work for horizontal or vertical lines. (Let us know if you need to set the length of angled lines.)
You could turn on the Grid and Snap, if the line length is a multiple of your grid size.
Or you can use the Select tool to select the line and then enter a specific width or height.