This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Cannot Find Symbol when trying to compile decompiled class. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Cannot Find Symbol when trying to compile decompiled class." Watch "Cannot Find Symbol when trying to compile decompiled class." New topic
Author

Cannot Find Symbol when trying to compile decompiled class.

Jeff Green
Greenhorn

Joined: Apr 21, 2010
Posts: 3
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

Joined: Feb 10, 2009
Posts: 710
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?


SCJA
When I die, I want people to look at me and say "Yeah, he might have been crazy, but that was one zarkin frood that knew where his towel was."
Jeff Green
Greenhorn

Joined: Apr 21, 2010
Posts: 3
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

Joined: Aug 16, 2005
Posts: 14074
    
  16

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.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Jeff Green
Greenhorn

Joined: Apr 21, 2010
Posts: 3
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...
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Cannot Find Symbol when trying to compile decompiled class.
 
Similar Threads
can not find methods
Jasper Reports
What is the "standard way" when getting data from a DB?
errors generated when running Ant build file in Eclipse
JList and selection problem