Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solution to "Could not find or load main class" on Windows #334

Open
Bernhard-Hiller opened this issue Nov 2, 2019 · 2 comments
Open

Solution to "Could not find or load main class" on Windows #334

Bernhard-Hiller opened this issue Nov 2, 2019 · 2 comments

Comments

@Bernhard-Hiller
Copy link

When an osmand tool is started from the Windows command line, but the current working directory is different from the folder that tool is located in, a "Could not find or load main class" exception is thrown from java.

This is caused by an insufficient classpath definition. Please change the call in e.g. inspector.bat to

java.exe -Djava.util.logging.config.file=logging.properties -Xms64M -Xmx512M -cp "%~dp0\OsmAndMapCreator.jar";"%~dp0\lib\*.jar" net.osmand.obf.BinaryInspector %*

and in the other .bat files accordingly.

@pyramid3d
Copy link

pyramid3d commented Dec 6, 2021

Not sure this is related but I do get this error:

java.lang.reflect.InaccessibleObjectException: Unable to make private java.util.Collections$EmptyMap() accessible: module java.base does not "opens java.util" to unnamed module @7692d9cc

tried running with the following command (openjdk 17) without change:

java $JAVA_OPTS -Djava.util.logging.config.file="$DIR/logging.properties" -jar "$DIR/OsmAndMapCreator.jar" --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED

EDIT
Oh, swapping the params worked:

java --add-opens java.base/java.util=ALL-UNNAMED $JAVA_OPTS -Djava.util.logging.config.file="$DIR/logging.properties" -jar "$DIR/OsmAndMapCreator.jar"

@mattmccutchen
Copy link

mattmccutchen commented Nov 15, 2022

@pyramid3d Looks to me like your issue is #484. Thanks for the workaround!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants