Script Error: Exception in thread “main” java.lang

2019-07-27 22:00发布

I'm running OpenStreetMap's Osmosis in Windows XP to cut a subset of data from a larger set. In various incarnations, the program either hangs or gives me the following error:

C:\Documents and Settings\mmorisy\tools>osmosis.bat --read-xml enableDateParsing
=no file="us_zipcodes.osm" --log-progress interval="10" --bounding-box top=43.22
868195 left=-73.5981635 bottom=41.2283584 right=-69.814204 --write-xml file="mas
s_zipcodes.osm"
Exception in thread "main" java.lang.NoClassDefFoundError: org/codehaus/classwor
lds/Launcher
Caused by: java.lang.ClassNotFoundException: org.codehaus.classworlds.Launcher
        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: org.codehaus.classworlds.Launcher.  Program will
exit.

I get the feeling that Java isn't properly installed or configured, but I have installed the most revent SDK from Oracle's website and can't figure out where else I might be going wrong, despite maybe half dozen variations.

1条回答
Emotional °昔
2楼-- · 2019-07-27 22:52

The error you're getting implies that Java itself is installed correctly, but it can't find the .class file it's trying to run.

At a guess, osmosis.bat has an incorrect -jar or -cp (or -classpath) argument to the classworlds.jar file in it.

查看更多
登录 后发表回答