开发者

Setting up Java Enviornmental Variables?

I have set JAVA_HOME = C:\Program Files\Java\jdk1.6.0_26 in user defined variables and system variables and classpath = .; in user defined variables PATH = C:\Program Files\Java\jdk1.6.0_26\bin in system variables.

Now when I type java on cmd on windows 7 os then am getting message - Error could not open `C:\Program Files\Java\jre6\lib\i386\jvm.cfg'.

Thing to note here is that initially only jre6 was defined in Java folder and so I开发者_Go百科 had to install jdk but still am getting this error any clue?

Update I have able to get java information, all I did was initially I had set up path variable information in following some %SYSTEM_ROOT% and other variables in the PATH Variables values but now I just put C:\Program Files\Java\jdk1.6.0_26\bin as first value in PATH Variables value list and so it worked, guess %SYSTEM_ROOT% has pre-defined settings for Path which was pointing to old jre path location.

  1. Now when I run java -version, I get following information, how do i know if java installed is 32-bit or 64-bit?

java version "1.6.0_26" Java(TM) SE Runtime Environment (build 1.6.0_26-b03) Java HotSpot(TM) Client VM (build 20.1-b02, mixed mode, sharing)


Your path variable is correct but for classpath variable use SET Classpath="C:\Program Files\Java\jdk1.6.0_26\lib"

JVM uses class path at run time to search for .class files.

By using ".;" JVM will search for .class files in bin directory whereas the compiled .class files of rt.jar are in lib directory.

This why you're facing errors.

learn more about classpath variable @ http://programmingbulls.com/classpath-variable-java


You can check if your on 32 or 64 bit by reading the "sun.arch.data.model" system property in java;

System.out.println(System.getProperty("sun.arch.data.model"));

Mine answers '64'.

You can view all available system properties with something like this;

Properties p = System.getProperties();
Enumeration keys = p.keys();
while (keys.hasMoreElements()) {
  String key = (String) keys.nextElement();
  String value = (String) p.get(key);
  System.out.println(key + ": " + value);
}


set path=%path%;"C:\Program Files\Java\jdk1.6.0_26\bin"

Setting up Java Enviornmental Variables?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜