How to configure Windows 2000 JDK (1)

  Java beginners often on how to configure Java development environment is confusing, the Forum is also a lot of friends asked about JDK configuration issues, in particular configuration, the java compiler of the document, always encountered such a problem, an error message as follows: 

  Microsoft Windows 2000 [Version 5.00.2195] 
  (C) Copyright 1985-1998 Microsoft Corp. 
  C:> javac HelloWorld.java 
  C:> java HelloWorld 
  Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorld 
  C:> 

  The above error message, the source is as follows: 

  Class HelloWorld ( 
  Public static void main (String [] args) ( 
  / / Display "Hello World!" 
  System.out.println ( "Hello World!"); 
  ) 
  ) 

  Translation by running on how Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorld ???????/ 

  For the above problems, we always solutions for the HelloWorld.java file directory path to join the classpath parameter, such as: set classpath =% classpath%.;…… (Here we should pay attention to them ".;", while in the end we have to be a pilot to see what is the meaning).    I tried, not like, I did not know whether it was a good allocation.    As for the answer to this problem is not the Internet a concrete practice, I do not know.    So, I have done a first attempt. 

  I use Win2000 + JDK1.30 in java.sun.com download j2sdk1_3_0-win.exe, and then click the installation, the default installation of the system path, install c: disk, namely: c: jdk130.    Installed need to configure the environment, which involved three parameters: path, classpath, java_home.    On my computer - "attributes -" High - "environment variable, add these three variables, respectively, and their values are as follows: 

  Name = value 

  Java_home = c: jdk130 (installation path) 
  Classpath =. C: jdk13lib ools.jar; C: jdk13libdt.jar; C: jdk13 in; 
  Path = C: jdk13 in; 

  Then we can determine. 

  Notes: classpath is used to indicate the type used for all the directory, which allows users to type in their own different directory, but we should let them know JDK compiler tools there.    For example: 

  Set classpath =. C: jdk13lib ools.jar; C: jdk13libdt.jar; C: jdk13 in; 

  The first order of dots specified classpath the current working directory.    The dots very useful when to enter the full path of the current directory, you can use it to replace, java programs allow to do so. 

  In the d: new subdirectory java, java preparation of a document named Hello.java into dos mode access to directory d: java, and then knockin javac Hello.java, the compiler through.    Then can be used java Hello Run the class documents, there is no problem, the result of normal output.    If we Hello.java document in the first sentence of Accession: package hello;, and then compiled, there was no mistake, we will see the running following message: 

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Facebook
  • DotNetKicks
  • DZone
  • Netvouz
  • Propeller

Tags:

Releated Java Articles

Comments

Leave a Reply