0

I have a maven project with a bunch of dependencies, one of which I'd like to print a line to console to called pulsar-log4j2-appender. I tried opening the .class file in question by following in Intellij:

External Libraries | Maven: org.apache.pulsar:pulsar-log4j2-appender:2.6.0 | pulsar-log4j2-appender-2.6.0.jar | org.apache.pulsar.log4j2.appender | PulsarManager.class

When I try to add a System.out.println statement, Intellij says the file is read only:

enter image description here

1
  • I'd like to change the source code.. debug was the wrong word, sorry Commented Jul 24, 2020 at 7:33

2 Answers 2

6

You cannot change code in external Maven dependencies.

You can debug them, though, with the debugger of your IDE and watch the values you are interested in.

If you really want to change the code, you need to find the project (e.g. on Github), check it out and build it yourself.

Sign up to request clarification or add additional context in comments.

Comments

3

Powered by Java bytecode decompiler plugin, IntelliJ decompiles Java bytecode into human-readable Java code When you try to open .class extension

Now, you're actually viewing Java decompiled bytecode(can't be edited inside the IDE), not actual Java code (.java extension).

The solution would be to modify the source code itself and rebuild it.

More info: https://blog.jetbrains.com/idea/2020/03/java-bytecode-decompiler/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.