I will share on this blog my experience on java programming. One thing for sure if you are beginners on programming is encountering errors on your program. Don't be discourage on errors because this will make you a better programmer. If you are a new java programmer you are prone to encounter errors on your program specially on run-time. A typical error is "class not found exception". I have a simple solution for this one. I hope this one helps.
Classnotfound error at run-time on java
When you create a java file or a program on java, you will have to compile that one like example bellow.
javac YourProgram.java
At compiling your java program, java will find your compiler. So java will look at your environment path for the class or compiler. If running a program at run-time (no error at compile time) finds a class not found error, this has something to do with your program class path. Your java program cannot find the class/es it needs to run.
Setup Java classpath on window 1. Go to Computer Properties ->Advanced->Environment Variables.
2. Edit System Variables - Path.
You need to append the Java classes that contains all the libraries that supports your application. These are the most important java folders that have all the utilities or classes you need. - Java\jdk\bin; -java\jdk\lib; -java\jdk\jre; Just find the directory of the important java folders like bin, lib and jre. You will not worry on running your programs or applications because it is really pointing to all your java classes set in the environment variables on windows system. For beginners, i recommend you to use IDE like eclipse or netbeans because it will set all the java libraries upon making your java project.
0 Comments
Leave a Reply. |
FollowCategories
All
Archives |