Historical records seem to contradict themselves on this matter. What I recall reading was that they were created for two different things: JavaScript was created to add basic interactivity on the page, and Java was intended to be used for more CPU-intensive work.