I think you might be confusing
Java, which is a programming language, with Javascript, which is used in HTML documents to accomplish special little chores that make your page do cool things. They aren't the same thing, although the names are similar.