I found this error while opening a .jar file in Windows 7 Ultimate operating system running on a Mac Book Pro.
Probable Cause 1: The environment variables are not set
Solution: You will need to set the three environment variables which are as follows. However don’t delete the entries already present in Path and CLASSPATH variables as it may stop other applications from working. In case you don't know how to change the enviroment variables in Windows, please see the bottom of this post.
JAVA_HOME: The home directory of your Java installation.
E.g.
C:\Program Files\Java\jdk1.6.0_17
Path: It lists directories the shell searches, for the commands the user may type without having to provide the full path.
E.g. E:\app\smachado\product\11.2.0\client_1\bin;E:\app\smachado\product\11.1.0\client_3\bin;E:\app\smachado\product\11.1.0\client_1\bin;D:\apache-ant-1.6.2-bin\apache-ant-1.6.2\bin;%JAVA_HOME%\bin
It is a good idea to set JAVA_HOME variable first. Include the full path till your Java bin directory. You don’t require to add %JAVA_HOME% in your Path variable, instead you will need to add the entire path till the bin directory for your Java installation.
CLASSPATH: The class path tells SDK tools and applications where to find third-party and user-defined classes.
Eg:
%JAVA_HOME%\bin;C:\PROGRA~1\IBM\SQLLIB\java\db2java.zip;C:\PROGRA~1\IBM\SQLLIB\java\db2jcc.jar;C:\PROGRA~1\IBM\SQLLIB\java\sqlj.zip;C:\PROGRA~1\IBM\SQLLIB\java\db2jcc_license_cisuz.jar;C:\PROGRA~1\IBM\SQLLIB\java\db2jcc_license_cu.jar;C:\PROGRA~1\IBM\SQLLIB\bin;C:\PROGRA~1\IBM\SQLLIB\tools\db2XTrigger.jar;C:\PROGRA~1\IBM\SQLLIB\java\common.jar;%JAVA_HOME%;C:\PROGRA~1\IBM\SQLLIB\java\db2java.zip;C:\PROGRA~1\IBM\SQLLIB\java\db2jcc.jar;C:\PROGRA~1\IBM\SQLLIB\java\sqlj.zip;C:\PROGRA~1\IBM\SQLLIB\java\db2jcc_license_cisuz.jar;C:\PROGRA~1\IBM\SQLLIB\java\db2jcc_license_cu.jar;C:\PROGRA~1\IBM\SQLLIB\bin;C:\PROGRA~1\IBM\SQLLIB\tools\db2XTrigger.jar;C:\PROGRA~1\IBM\SQLLIB\java\common.jar;D:\apache-ant-1.6.2-bin\apache-ant-1.6.2\lib
To set the environment variables in Linux, you will have to use the export command from console/terminal window.
Eg: export JAVA_HOME= /opt/Java
Try opening the Jar file now. In Windows it is wiser to open a .jar file using javaw.exe inside the bin directory of you Java installation.
Probable Cause 2: You just copied the Java SDK folder into your system without running an installer (Windows).
Solution: Set the environment variables as above.
Verification:
Go to the command prompt and just type
java –version
Workaround:
Delete all installations and install a fresh new copy of Java and then set the environment variables.
Follow these steps to set an environment variable in Windows:
To view or change environment variables:- Right-click My Computer, and then click Properties.
- Click the Advanced tab.
- Click Environment variables.
- Click one the following options, for either a user or a system variable:
- Click New to add a new variable name and value.
- Click an existing variable, and then click Edit to change its name or value.
- Click an existing variable, and then click Delete to remove it.
0 comments:
Post a Comment
What do you think?.