• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cannot Find Symbol when trying to compile decompiled class.

 
Jeff Green
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have decompiled a class file and made a change to a hard-coded path. Now, I want to recompile it but know nothing about JAVA. When I attempt to recompile I get several Cannot Find Symbol errors. Here are some of them...

C:\JARFiles\EINSTR~1\dm\ui\SERIAL~1\StoredPreferencesManager.java:104: cannot find symbol
symbol : class ElementList
location: class einstruction.dm.ui.serialization.StoredPreferencesManager
@ElementList
^
C:\JARFiles\EINSTR~1\dm\ui\SERIAL~1\StoredPreferencesManager.java:100: cannot find symbol
symbol : variable einstruction
location: class einstruction.dm.ui.serialization.StoredPreferencesManager
private static final Logger logger = Logger.getLogger(einstruction/dm/ui/serialization/StoredPreferencesManager.getName());
^
C:\JARFiles\EINSTR~1\dm\ui\SERIAL~1\StoredPreferencesManager.java:100: cannot find symbol
symbol : variable dm
location: class einstruction.dm.ui.serialization.StoredPreferencesManager
private static final Logger logger = Logger.getLogger(einstruction/dm/ui/serialization/StoredPreferencesManager.getName());
^
C:\JARFiles\EINSTR~1\dm\ui\SERIAL~1\StoredPreferencesManager.java:100: cannot find symbol
symbol : variable ui
location: class einstruction.dm.ui.serialization.StoredPreferencesManager
private static final Logger logger = Logger.getLogger(einstruction/dm/ui/serialization/StoredPreferencesManager.getName());

I'm sure there's something simple I'm just not including in the correct class path or something. Any help with this is greatly appreciated. I can give additional information if needed. Thanks!
 
W. Joe Smith
Ranch Hand
Posts: 710
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could have missing entries on your classpath, but I want to ask another question...Why are you decompiling the class to make a change? Do you have access to the original .java file?
 
Jeff Green
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I work for a school system and theres some software we have and the developers used user.home to try to retrieve the user's home directory and apparently there's a known bug I've read about that hasn't been fixed yet having to do with this. I needed to change the path a file pointed to so it would fix our problem. Unfortunately, I do not have access to the original files. I do have the JAR files that I decompiled though.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15441
41
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Note that not all Java decompilers produce actual Java source code that can be directly recompiled. Some decompilers generate a kind of pseudo-Java code, that's not really valid Java. I see the decompiled code you are trying to compile contains lines like this:

That's not valid Java source code (with the slashes). It should probably be something like this:

Is there no way you can get the original source code? Relying on decompiled source code is not a good idea.
 
Jeff Green
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah ok that is interesting. It gives an error after every forward slash too. I will go through and change those to dots and see if it fixes things. Thanks for the replies so far! I wish I could get ahold of the original code but all I can do is decompile.

Making those changes got my errors down to 9 so maybe I'm getting close...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic