my dog learned polymorphism
The moose likes Beginning Java and the fly likes Error running program Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Error running program" Watch "Error running program" New topic

Error running program

R Shetty

Joined: Feb 04, 2006
Posts: 7
Beginner question:

I'm new to Java and want to know how to compile class in a different folder than C:\Program Files\Java\jdk1.5.0_06\bin (which is what is set as my path variable)

Compiling and running a file saved there works fine but when I move the source file to a different folder say C:\TestJava the compilation works but running the file gets me this error:

"Exception in thread "main".UnsupportedClassVersionError...

Thank you for your help

Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
My guess is that you have a JVM installed as a plug-in to a browser or something like that on your machine, and the path to it's bin directory is in your PATH, but the bin directory of your JDK installation is either in the PATH after that location or is not in your PATH. I would check the PATH and add the bin directory of your JDK installation before any other locations that might contain an interpreter.
R Shetty

Joined: Feb 04, 2006
Posts: 7
Keith, thank you very much for your help!

Very fast response and your suggestion worked. I did not scroll down far enough in the system variables to see the PATH and so created one in the user variables. When I saw it I deleted the one I created and put the bin path as the first one in the Path variable.

I agree. Here's the link:
subject: Error running program
It's not a secret anymore!