File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Basic Question about main Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Basic Question about main" Watch "Basic Question about main" New topic

Basic Question about main

Awais Sheikh
Ranch Hand

Joined: Jun 07, 2006
Posts: 48
I have installed jdk and I m placing my class files or packages in c:/java/bin/. I created another folder on c: root and placed my class files in c:/javaPrep folder. Classes are compling successfully but when i try to run the class file it give me message that

But when I places this package containing in bin folder it works fine. I have added already c:/javaPrep in classpath. but not working.
Please guide me how to do this.

Naseem Khan
Ranch Hand

Joined: Apr 25, 2005
Posts: 809
This could be because of the version of compiler and jvm is not same.

Have you installed two j2sdk on your machine.?

Asking Smart Questions FAQ - How To Put Your Code In Code Tags
Avishek Banerjee

Joined: Jul 11, 2006
Posts: 17
If your package's directory structure is like c:->test->javaprep, then the class path should be only upto test. Don't include javaprep. In your case the classpath should have only c:\. Classpath should always mention the parent direcroty of the package directory. But, still the runtime error looks strange. It should acuatlly be . Anyways, try this.

Avishek<br />SCJP 5.0 - 90%
Awais Sheikh
Ranch Hand

Joined: Jun 07, 2006
Posts: 48
Thanks a lot for your helping replies

Thats the problem you are right. Actually on my system oracle is installed as well. Now I checked version of java and javac as below as showing 2 different version

So thats why .class file was not running. Now my confusion is clear. Thanx a lot your prompt and helpfull answer.

Thats not the problem Mr. Naseem pointed out the right point. thanks for your reply.
I agree. Here's the link:
subject: Basic Question about main
It's not a secret anymore!