Yritän käynnistää Win7:lla .jar ohjelmaa kaksoisklikkauksella. Tulee tällainen ilmoitus:
D:\Downloads>bdsup2sub.jar
Exception in thread "main" java.lang.NoClassDefFoundError: D:\Downloads\BDSup2Sub/jar
Caused by: java.lang.ClassNotFoundException: D:\Downloads\BDSup2Sub.jar
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: D:\Downloads\BDSup2Sub.jar. Program will
exit.
Ohjelma käynnistyy hyvin komentoriviltä komennolla "java -jar bdsup2sub.jar".
Koneessa on Win7 x64 ja asennettuna on sekä 64- että 32-bittinen Java RE.
Missä on vika?
Lainaus:Sounds like you are hitting a problem with javaw.exe or have more than one
version of the java virtual machine installed and the wrong one is getting
used when double-clicking
First, make sure you only have 1 version of the j2sdk/jre installed. I
installed the j2sdk 1.3 for a work-related project and then installed the
j2sdk 1.4 for a class I taught. Turns out that even though my "java plug
in" was set to the j2sdk1.4, the windows registry mapped the jarfile to be
opened with the 1.3 j2sdk. This caused jar files to hang when I
double-clicked them.
If you are comfortable with the windows registry and using regedit.exe check
these two locations:
HKEY_CLASSES_ROOT\jarfile\shell\open\command
make sure the path for javaw.exe is correct
Also check under:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\Curr ent Version\App Paths
There may or may not be a folder for java.exe and javaw.exe here, but if
there is make sure the path is to the correct executable.
Another possibility is that some people experience problems with javaw.exe,
which is supposed to be just like java.exe execept that it does not pop open
a command prompt window. To double-check that its really this kind of
issue, click the Windows Start button, then click Run and type in the
command line (for example, java -jar c:\stuff\blah.jar) to run your "jar
program". Then try it with: javaw -jar c:\stuff\blah.jar
If it hangs with javaw and not java, then you can change the Windows
registry for the HKEY_CLASSES_ROOT\jarfile\shell\open\command to use
java.exe instead of javaw.exe
Lainaus:Sounds like you are hitting a problem with javaw.exe or have more than one
version of the java virtual machine installed and the wrong one is getting
used when double-clicking
First, make sure you only have 1 version of the j2sdk/jre installed. I
installed the j2sdk 1.3 for a work-related project and then installed the
j2sdk 1.4 for a class I taught. Turns out that even though my "java plug
in" was set to the j2sdk1.4, the windows registry mapped the jarfile to be
opened with the 1.3 j2sdk. This caused jar files to hang when I
double-clicked them.
If you are comfortable with the windows registry and using regedit.exe check
these two locations:
HKEY_CLASSES_ROOT\jarfile\shell\open\command
make sure the path for javaw.exe is correct
Also check under:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\Curr ent Version\App Paths
There may or may not be a folder for java.exe and javaw.exe here, but if
there is make sure the path is to the correct executable.
Another possibility is that some people experience problems with javaw.exe,
which is supposed to be just like java.exe execept that it does not pop open
a command prompt window. To double-check that its really this kind of
issue, click the Windows Start button, then click Run and type in the
command line (for example, java -jar c:\stuff\blah.jar) to run your "jar
program". Then try it with: javaw -jar c:\stuff\blah.jar
If it hangs with javaw and not java, then you can change the Windows
registry for the HKEY_CLASSES_ROOT\jarfile\shell\open\command to use
java.exe instead of javaw.exe
Nyt rupesi toimimaan. Poistin 64-bittisen Javan ja samoin todellisen kiusankappaleen eli Ovi Suiten, joka yritti väkisin ottaa haltuunsa .jar tiedoston.