question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Illegal Access Error

See original GitHub issue

Hi, When I run java -cp ./instrumentor/build/libs/kelinci.jar edu.cmu.sv.kelinci.instrumentor.Instrumentor -i ../bin -o ../bin-instrumented I get the following error

Loading dir: ../bin Found file ../bin/sorting_algo/sorting.class Found file ../bin/Driver.class WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by edu.cmu.sv.kelinci.instrumentor.Options (file:/home/amit/dev-work/Cost_Model_NN/new_fuzzing/kelinci/instrumentor/build/libs/kelinci.jar) to method java.net.URLClassLoader.addURL(java.net.URL) WARNING: Please consider reporting this to the maintainers of edu.cmu.sv.kelinci.instrumentor.Options WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release Exception in thread "main" java.lang.RuntimeException: Error adding location to class path: ../bin at edu.cmu.sv.kelinci.instrumentor.Options.addToClassPath(Options.java:62) at edu.cmu.sv.kelinci.instrumentor.Options.getInput(Options.java:46) at edu.cmu.sv.kelinci.instrumentor.Instrumentor.main(Instrumentor.java:43)

I have tried changing my JDK from 11 to 8 but I still get the same error. Any ideas on how to fix this?

Thanks

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:2
  • Comments:6

github_iconTop GitHub Comments

2reactions
escubecommented, Oct 24, 2019

I solved the problem in this way :

  1. Removed all library from -cp command and left only kelenci. At this point I had another exception that is : java.lang.IllegalArgumentException at org.objectweb.asm.ClassReader.<init>(Unknown Source) at org.objectweb.asm.ClassReader.<init>(Unknown Source) at org.objectweb.asm.ClassReader.<init>(Unknown Source) at edu.cmu.sv.kelinci.instrumentor.Instrumentor.main(Instrumentor.java:55)

The excpetion was not very clear, so I updated org.ow2.asm from version 5.2 to version 7.2.

It is compiling fine now.

1reaction
WayneDevMazecommented, Nov 25, 2022

change to java8, worked!!!

  1. install 安装 sudo apt-get install openjdk-8-jdk

  2. change version 变化Java版本 sudo update-java-alternatives -s java-8-oracle 图片 注:变更版本可以在这里查看 ls /usr/lib/jvm/java-8-oracle

  3. 重新执行,执行一定要sudo

Read more comments on GitHub >

github_iconTop Results From Across the Web

IllegalAccessError in Java - Baeldung
An IllegalAccessError is thrown when an application attempts to access a field or invoke a method that is inaccessible.
Read more >
java.lang.IllegalAccessError: tried to access method
This happens when accessing a package scoped method of a class that is in the same package but is in a different jar...
Read more >
java.lang.IllegalAccessError - How to resolve Illegal Access ...
The IllegalAccessError extends the IncompatibleClassChangeError , which is thrown when an incompatible class change has occurred to some class ...
Read more >
IllegalAccessError (Java Platform SE 7 )
Thrown if an application attempts to access or modify a field, or to call a method that it does not have access to....
Read more >
IllegalAccessError Class (Java.Lang) - Microsoft Learn
Thrown if an application attempts to access or modify ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found