Trying to use the following code snippet in my Kotlin project.
WebSitemapGenerator wsg = new WebSitemapGenerator("http://www.example.com", myDir);
WebSitemapUrl url = new WebSitemapUrl.Options("http://www.example.com/index.html")
.lastMod(new Date()).priority(1.0).changeFreq(ChangeFreq.HOURLY).build();
wsg.addUrl(url);
wsg.write();
I'm getting the following error during the runtime.
Exception in thread "main" java.lang.IllegalAccessError: tried to access class com.redfin.sitemapgenerator.ISitemapUrl from class Main
at Main.run(Main.kt:20)
at Main$Companion.main(Main.kt:38)
at Main.main(Main.kt)
The ISitemapUrl interface is not public and it's creating the problem when i try to access the wsg.addUrl(url).
Solution:
Changing the scope of the ISitemapUrl interface from default to public fixes the issue.
Trying to use the following code snippet in my Kotlin project.
I'm getting the following error during the runtime.
The
ISitemapUrl
interface is not public and it's creating the problem when i try to access thewsg.addUrl(url)
.Solution:
ISitemapUrl
interface fromdefault
topublic
fixes the issue.