aspose file tools*
The moose likes Beginning Java and the fly likes please help me to set the path Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "please help me to set the path" Watch "please help me to set the path" New topic
Author

please help me to set the path

monica mitra
Greenhorn

Joined: Jun 16, 2006
Posts: 7
I have WINDOWS XP at my system.I set the path in this way.From start manu i entered in to Control Panel then to Performane & Maintenance then I clicked on System & then Advanced & then Environment Variables.Then in side System Varibles i wrote the following line in to "path" starting from it's right end
"c:\program files\java\jdk1.5.0_<version>\bin".
have i done make some mistake?Please correct me.Waiting for reply .
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by monica mitra:
...i wrote the following line in to "path" starting from it's right end
"c:\program files\java\jdk1.5.0_<version>\bin".
have i done make some mistake? ...

Where the example says <version> you need to substitute whatever version you're using (that is, the actual name of the directory). For example, if you have update 7, the path would be...

c:\program files\java\jdk1.5.0_07\bin

See these installation instructions for more details.


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
monica mitra
Greenhorn

Joined: Jun 16, 2006
Posts: 7
I can now compile the program. but when I try to run the program by typing java classname say java Add .It throws me an exception message "Exception in thread "main" java.lang.NoClassDefFoundError:Add".
why am i getting this message ?what should I do?
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40052
    
  28
"Exception in thread "main" java.lang.NoClassDefFoundError:Add".
You can find out about run time error messages here. That message means one of many things described on that website, most of which are unlikely in this instance.

The most likely explanations are that you haven't actually compiled the Add class (use the dir command on command prompt to find the Add.class file) OR that the Add class doesn't have a public static void main(String[] args) method in. Remember that is the bit the JVM is looking for; if it doesn't find it, the NoClassDefFoundError is how it responds.
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

First, if you've compiled successfully, then you should have a .class file in the directory. Have you verified that Add.class exists?

Second, when you enter java Add on the command line, your working directory should probably be the directory that contains the Add.class file. (This is not always the case. But I'm making an assumption because it appears this is one of your first programs after getting the Java compiler installed.) You change directories by typing cd followed by a space and then the path of the desired directory.

Third, I'm also hoping that you have not set a system CLASSPATH variable (which is different than a PATH variable). If you have set a system CLASSPATH without knowing exactly why, then I suggest you remove it completely. If you have set a system CLASSPATH and you really do need to keep it, then make sure it includes a dot (.) to indicate the current directory.
[ June 17, 2006: Message edited by: marc weber ]
monica mitra
Greenhorn

Joined: Jun 16, 2006
Posts: 7
I can successfully compile and run the program.Thanks for help.
I'm planning to take scjp5.0.What should I do to score good percentage?
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by monica mitra:
... I'm planning to take scjp5.0. What should I do to score good percentage?

That's great! Here is our SCJP FAQ from our SCJP forum. That should help you get started.

Basically, I recommend that you...
  • Learn the Java basics first, without concentrating on the SCJP objectives. Use a good book, like Head First Java.
  • As you're learning, write lots of test code to reinforce the concepts.
  • After you have a foundation, then start to focus on the SCJP objectives. Again, a good book that's specifically geared to the desired exam version is essential.
  • As you're preparing, write lots of test code to test your understanding.
  • As you get closer to taking the exam, take as many mock exams as possible to get familiar with the types of questions and find out where you need to spend more time studying.
  • (You'll notice that I listed "write lots of test code" twice.)

    PS: What was the problem running the program? Did you have a CLASSPATH set?
    bama sabapathi
    Greenhorn

    Joined: Apr 05, 2002
    Posts: 8
    I have Windows Xp Home Edition in my Home Computer.I installed Java 1.5 in C:\Program Files\Java\Jdk1.5.0_06 path.I am trying to execute example.java in C:\Java path.it is giving "javac" is not recoginsed as an internal or external command,operable pragram or batch file" comes each time when i try to compile the program.

    Please help me to solve this Problem.
    Thanks,
    Bama
    Campbell Ritchie
    Sheriff

    Joined: Oct 13, 2005
    Posts: 40052
        
      28
    Bama Sabapathi: Go to Marc Weber's first post in this thread, and follow the installation instructions quoted, to the letter. A single spellign mistake and nothing will work.
    marc weber
    Sheriff

    Joined: Aug 31, 2004
    Posts: 11343

    Originally posted by Campbell Ritchie:
    ...and follow the installation instructions quoted, to the letter...

    Especially Step 5.
    bama sabapathi
    Greenhorn

    Joined: Apr 05, 2002
    Posts: 8
    thank you marc.I am finally sucessfully running JDK1.5.
    Thanks,
    Bama.
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: please help me to set the path