Let's call the horizontal velocity Vx and the vertical velocity Vy. The angle of elevation of the flight path we will call E. With these definitions Vx=25 m/s * cos(E) and Vy=25 m/s * sin(E).
Neglecting air resistance the path of the javelin will be symmetrical about the highest point of its flight. The time (t) to reach that highest point will be the vertical velocity divided by the constant acceleration of gravity (9.8 m/s/s). t=25 m/s*sin(E)/9.8 m/s/s.
Due to the symmetry of the path the total flight time will be 2*t. The distance covered will be the horizontal velocity times the total flight time or 2*t*25*cos(E), or, 2*25/9.8*sin(E)*25*cos(E).
There is a trig identity that 2*sin(E)*cos(E)==sin(2*E) so the distance covered is 252*sin(2*E)/9.8. This distance will be maximum when sin(2*E) takes on its maximum value of 1.0. That happens when 2*E=90 degrees or E=45 degrees. The best distance then will be the initial velocity squared divided by the acceleration of gravity. In this case about 63.8 meters.