0

Relatively new to Java - I just one to update ONE file inside a JAR file. I've decompiled the JAR, and have access to the Java file.

I am trying to use javac, however when I am using it, it throws errors as it doesn't have references to various dependencies.

Do I need to compile everything to get rid of these? Is there a simple way to just compile the one file?

javac MessageNotificationService.java
...

MessageNotificationService.java:108: error: cannot find symbol
        List<EmailNotification> pendingEmails = this.messageDao.findPendingNotification("merchant", "new_message");
             ^
  symbol:   class EmailNotification
  location: class MessageNotificationService
MessageNotificationService.java:111: error: cannot find symbol
            List<Long> ids = pendingEmails.stream().map(EmailNotification::getId).collect(Collectors.toList());
                                                        ^
  symbol:   variable EmailNotification
  location: class MessageNotificationService
MessageNotificationService.java:182: error: cannot find symbol
        for (EmailNotification notification : pendingEmails) {
             ^
  symbol:   class EmailNotification
  location: class MessageNotificationService
39 errors

Sorry if this is a basic question - all of the search results on this seem to be for self-contained files that don't have errors like this.

1
  • The compiler needs access to all the classes involved. You can do that by some combination of compiling multiple classes at once and providing a classpath for it to find library classes. Commented Jul 25, 2019 at 17:41

1 Answer 1

1

As far as I can tell, you just point to the old JAR file

javac -cp "./old-jar-file-1.0.0.jar" ./location-of-file/MessageNotificationService.java
Sign up to request clarification or add additional context in comments.

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.