• Post Reply Bookmark Topic Watch Topic
  • New Topic

JRE and exception example  RSS feed

 
Dan Bromberg
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We've all read the definition of the JRE:
"The Java Runtime Environment (JRE) provides the libraries, Java virtual machine, and other components necessary to run applets and applications written in the Java programming language".

Yet I never see examples of the 'libraries' immediately following this definition and never felt comfortable about what is meant by a runtime exception. I assume that they mean something illegal has happened to a runtime library when a program was running. But doesn't that always happen when a program fails?

So if anyone could provide a real simple example of a runtime library [aren't all libraries used at 'runtime' ?] and how an exception happens to it I'd be most appreciative. Also, do exceptions happen to libraries I create or only the ones provided by SUN?

Thanks in advance to all replies.

Danny
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a look at the lib directory in your JDK or JRE installation directory. You will see a number of JAR files and DLL's (or other native shared library files depending on your operating system) there. Those are the libraries that is talked about in the statement. All the classes in the standard Java API (everything in all packages named java.* and more) are in the file rt.jar, which is one of the libraries.

Exceptions happen when a line of code throws one with the "throw" statement, for example:

Look at this part of The Java Tutorial for in-depth information about exceptions: The Java Tutorial - Lession: Exceptions
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!