Offroad doesn't start

When I start Offroad from the launcher nothing happens at all and by the terminal I get the following output:

$ offroad
Mai 26, 2023 8:42:40 PM net.sourceforge.offroad.OsmWindow getAppPath
INFORMATION: Searching for /home/space/.OffRoad/offroad.properties
java.io.FileNotFoundException: /home/space/.OffRoad/offroad.properties (Datei oder Verzeichnis nicht gefunden)
        at java.base/java.io.FileInputStream.open0(Native Method)
        at java.base/java.io.FileInputStream.open(FileInputStream.java:219)
        at java.base/java.io.FileInputStream.<init>(FileInputStream.java:158)
        at net.sourceforge.offroad.OffRoadSettings.readDefaultPreferences(OffRoadSettings.java:125)
        at net.sourceforge.offroad.OffRoadSettings.<init>(OffRoadSettings.java:94)
        at net.sourceforge.offroad.OsmWindow.<init>(OsmWindow.java:232)
        at net.sourceforge.offroad.OsmWindow.getInstance(OsmWindow.java:1154)
        at net.sourceforge.offroad.OsmWindow.main(OsmWindow.java:866)
Panic! Error while loading offroad properties.
Mai 26, 2023 8:42:40 PM net.sourceforge.offroad.OsmWindow getAppPath
INFORMATION: Searching for /home/space/.OffRoad/
java.nio.file.NoSuchFileException: /home/space/.OffRoad
Create prefs for net.osmand.settings.default
Create prefs for offroad
WARNING: Found path as /res/values-de/strings.xml instead of res/values-de/strings.xml
Mai 26, 2023 8:42:40 PM net.sourceforge.offroad.OsmWindow loadStrings
INFORMATION: Trying to load resources sun.net.www.protocol.jar.JarURLConnection$JarURLInputStream@4c3e4790
Mai 26, 2023 8:42:40 PM com.sun.xml.bind.v2.runtime.reflect.opt.Injector <clinit>
SCHWERWIEGEND: null
java.security.PrivilegedActionException: java.lang.NoSuchMethodException: sun.misc.Unsafe.defineClass(java.lang.String,[B,int,int,java.lang.ClassLoader,java.security.ProtectionDomain)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:575)
        at com.sun.xml.bind.v2.runtime.reflect.opt.Injector.<clinit>(Injector.java:197)
        at com.sun.xml.bind.v2.runtime.reflect.opt.AccessorInjector.prepare(AccessorInjector.java:81)
        at com.sun.xml.bind.v2.runtime.reflect.opt.OptimizedAccessorFactory.get(OptimizedAccessorFactory.java:179)
        at com.sun.xml.bind.v2.runtime.reflect.Accessor$FieldReflection.optimize(Accessor.java:285)
        at com.sun.xml.bind.v2.runtime.property.ArrayProperty.<init>(ArrayProperty.java:68)
        at com.sun.xml.bind.v2.runtime.property.ArrayERProperty.<init>(ArrayERProperty.java:88)
        at com.sun.xml.bind.v2.runtime.property.ArrayElementProperty.<init>(ArrayElementProperty.java:100)
        at com.sun.xml.bind.v2.runtime.property.ArrayElementNodeProperty.<init>(ArrayElementNodeProperty.java:62)
        at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:67)
        at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:484)
        at com.sun.xml.bind.v2.runtime.property.PropertyFactory.create(PropertyFactory.java:128)
        at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.<init>(ClassBeanInfoImpl.java:181)
        at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getOrCreate(JAXBContextImpl.java:514)
        at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:331)
        at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:139)
        at com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1156)
        at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:165)
        at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:289)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
        at java.base/java.lang.reflect.Method.invoke(Method.java:578)
        at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:217)
        at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:175)
        at javax.xml.bind.ContextFinder.find(ContextFinder.java:353)
        at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:508)
        at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:465)
        at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:366)
        at net.sourceforge.offroad.OsmWindow.loadStrings(OsmWindow.java:980)
        at net.sourceforge.offroad.OsmWindow.initStrings(OsmWindow.java:939)
        at net.sourceforge.offroad.OsmWindow.<init>(OsmWindow.java:890)
        at net.sourceforge.offroad.OsmWindow.getInstance(OsmWindow.java:1154)
        at net.sourceforge.offroad.OsmWindow.main(OsmWindow.java:866)
Caused by: java.lang.NoSuchMethodException: sun.misc.Unsafe.defineClass(java.lang.String,[B,int,int,java.lang.ClassLoader,java.security.ProtectionDomain)
        at java.base/java.lang.Class.getMethod(Class.java:2321)
        at com.sun.xml.bind.v2.runtime.reflect.opt.Injector$3.run(Injector.java:201)
        at com.sun.xml.bind.v2.runtime.reflect.opt.Injector$3.run(Injector.java:197)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:571)
        ... 32 more

Exception in thread "main" java.lang.NullPointerException: Cannot invoke "java.lang.reflect.Method.invoke(Object, Object[])" because "com.sun.xml.bind.v2.runtime.reflect.opt.Injector.defineClass" is null
        at com.sun.xml.bind.v2.runtime.reflect.opt.Injector.inject(Injector.java:311)
        at com.sun.xml.bind.v2.runtime.reflect.opt.Injector.inject(Injector.java:97)
        at com.sun.xml.bind.v2.runtime.reflect.opt.AccessorInjector.prepare(AccessorInjector.java:87)
        at com.sun.xml.bind.v2.runtime.reflect.opt.OptimizedAccessorFactory.get(OptimizedAccessorFactory.java:179)
        at com.sun.xml.bind.v2.runtime.reflect.Accessor$FieldReflection.optimize(Accessor.java:285)
        at com.sun.xml.bind.v2.runtime.property.ArrayProperty.<init>(ArrayProperty.java:68)
        at com.sun.xml.bind.v2.runtime.property.ArrayERProperty.<init>(ArrayERProperty.java:88)
        at com.sun.xml.bind.v2.runtime.property.ArrayElementProperty.<init>(ArrayElementProperty.java:100)
        at com.sun.xml.bind.v2.runtime.property.ArrayElementNodeProperty.<init>(ArrayElementNodeProperty.java:62)
        at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:67)
        at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:484)
        at com.sun.xml.bind.v2.runtime.property.PropertyFactory.create(PropertyFactory.java:128)
        at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.<init>(ClassBeanInfoImpl.java:181)
        at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getOrCreate(JAXBContextImpl.java:514)
        at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:331)
        at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:139)
        at com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1156)
        at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:165)
        at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:289)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
        at java.base/java.lang.reflect.Method.invoke(Method.java:578)
        at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:217)
        at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:175)
        at javax.xml.bind.ContextFinder.find(ContextFinder.java:353)
        at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:508)
        at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:465)
        at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:366)
        at net.sourceforge.offroad.OsmWindow.loadStrings(OsmWindow.java:980)
        at net.sourceforge.offroad.OsmWindow.initStrings(OsmWindow.java:939)
        at net.sourceforge.offroad.OsmWindow.<init>(OsmWindow.java:890)
        at net.sourceforge.offroad.OsmWindow.getInstance(OsmWindow.java:1154)
        at net.sourceforge.offroad.OsmWindow.main(OsmWindow.java:866)
$ 

Does anyone have a clue what’s wrong?

Wrong java version. Looking at the wiki: OffRoad / Wiki / Home It needs java 8, but java 20 is the current release. And here: OffRoad / Code / [5cee11] you can see that version 0.6 should work with newer java version.

pamac install jre8-openjdk  
sudo archlinux-java set java-8-openjdk/jre
offroad

You can also modify the /usr/bin/offroad and replace java with /usr/lib/jvm/java-8-openjdk/jre/bin/java. (Of course in your home folder :wink: )

Thank’s for your quick reply.

If I use set Java 8 wouldn’t that interfere which other packages which need a higher version of Java?

or

is that the reason for the alternative you mentioned?

Sorry, I really don’t get how to manage it the best way.

(Offroad is a community project, not even AUR and why is that all together?)

Is it a rhetorical question? :slightly_smiling_face:

Alright then. :wink:

Ask the ArchLinux Maintainers, since this package is just imported from AchLinux. Probably it worked before with an older java version, but not now anymore? Anyway, I don’t use it.

Just commented on this today Which JRE to select? - #7 by 6x12
Run this and it works:

sudo pacman -S jre11-openjdk jre11-openjdk-headless
PATH="/usr/lib/jvm/java-11-openjdk/bin/:$PATH" offroad

EDIT: This will only start Offroad onc and create the .OffRoad folder in your home directory. As @koshikas in his post below pointed out, to get a permanent solution we need to create an executable startup.sh script that references the correct java version, in my case:

#!/bin/sh

export PATH="/usr/lib/jvm/java-11-openjdk/bin/:$PATH"
exec /usr/bin/offroad "$@"

and edit the Menu entry for OffRoad by pointing at startup.sh.

1 Like

How would I modify the launcher to execute that terminal command.
I’ve tried to paste it in the terminal section of the launcher menu, but Offroad doesn’t start in that way.
Any idea?

Copy the desktop file then edit that:

mkdir -p ~/.local/share/applications
cp /usr/share/applications/offroad.desktop ~/.local/share/applications/

Then edit the exec line to look like this:

Exec=/bin/sh -c 'PATH="/usr/lib/jvm/java-11-openjdk/bin/:$PATH" offroad'

That should work and survive updates.

Just tried it

[Desktop Entry]
Categories=Utility;Maps;
Comment=Offline Vector Map ported from OsmAnd
Exec=/bin/sh -c 'PATH="/usr/lib/jvm/java-11-openjdk/bin/:$PATH" offroad'
Icon=offroad
Name=Offroad
NoDisplay=false
Path=
StartupNotify=true
Terminal=false
TerminalOptions=
Type=Application
Version=1.0
X-KDE-SubstituteUID=false
X-KDE-Username=

but doesn’t work/launch unfortunately.

Do you mean that it did not start at all, or that it produced the same error as before?

Either way, the desktop database may need to be updated, either through update-desktop-database or logging out and back in, if you have not already done so.

Offroad starts via Terminal, but not via the Laucher

Yes, I restarted Manjaro.

Maybe try this:

Exec=env PATH="/usr/lib/jvm/java-11-openjdk/bin/:$PATH" offroad
3 Likes

in my case i just created a shell script and run it from the launcher/menu;
shell script;

#!/bin/sh

export PATH="/usr/lib/jvm/java-8-openjdk/bin/:$PATH"
exec /usr/bin/offroad "$@"
2 Likes

Yes, thank you, that makes my one time ‘solution’ permanent. I hope you don’t mind me adding your startup command to my post marked with the ‘solution’ so that future help-seekers get proper value. Solution should be shared here.

Just out of fairness,

that is a solution as well (beside the script solution of @koshikas)!
Thank you @megavolt

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.