File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes update jar file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "update jar file" Watch "update jar file" New topic
Author

update jar file

sumedha vangury
Greenhorn

Joined: Jun 17, 2012
Posts: 29
Hi,i am using a jar file in a different program and when i run the program i get multiple "cannot find symbol" error.

As much as i know the errors are probably because the java version that i am using is higher than the java version with which the jar was compiled.

The jar file does not contain the source so i cannot see the java files,only the class files are there.

My question is,is there any way in which i can recompile all the .class files,with the new java version that i am using.How to do it??Hope to get some help.
Thankyou.
sumedha vangury
Greenhorn

Joined: Jun 17, 2012
Posts: 29
Hi,i got the source file that contains all the related java programs.So what should i do now? should i compile all the .java files from the zip folder and paste them in the jar file that i have??Thankyou.
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3446
    
  12
sumedha vangury wrote:So what should i do now?

You suspect that the files in the jar were compiled with the wrong java version.
You have the source files.
You think that compiling all the .java files from the zip folder and paste them in the jar file might be a solution.
What do you think you should do ?


Joanne
sumedha vangury
Greenhorn

Joined: Jun 17, 2012
Posts: 29
Yes i know i gave the sollution myself but i just wanted to confirm if there is a better and faster way to do it.Because there are like 50 .java files and i cannot compile them using javac *.java as there are multiple folders in the same jar file
Tony Docherty
Bartender

Joined: Aug 07, 2007
Posts: 2232
    
  47
I think you are barking up the wrong tree, if there was a Java version compatibility issue you wouldn't be getting a "cannot find symbol" error. BTW this looks more like a compiler error are you sure you are getting it when running the program.
sumedha vangury
Greenhorn

Joined: Jun 17, 2012
Posts: 29
It has happened with me a few times when there was a version compatibility issue i would get the "cannot find symbol" errors and later resolved using a higher version of java,so on that basis i think it might be the same problem.
When i try to use the jar file (for my requirements in the project),the .class file is created but i get the errors cannot find symbol.

The errors are nothing related to the java file(the java is the basic hello world program),so i assume that i am getting all the"cannot find symbol" errors due to the version compatibility issue of the jar file.

Is there any solution to this problem or should i actually sit and re compile all the 50 .java files ONE BY ONE.It would really be breathtaking to do that and i dont know how much time would i actually have to spend doing it
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3446
    
  12
sumedha vangury wrote:Is there any solution to this problem or should i actually sit and re compile all the 50 .java files ONE BY ONE.It would really be breathtaking to do that and i dont know how much time would i actually have to spend doing it

It might be more useful to spend the time learning how to use a build tool (ant, maven, etc). That way, next time you have a similar problem you'll know a quick solution



sumedha vangury
Greenhorn

Joined: Jun 17, 2012
Posts: 29
Actually i did not yet get the answer to my first question,if that is answered rest all is solved.Is there a way in which i can recompile all the class files of a jar file with a different version of java?Please,i really need it.
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3446
    
  12
No. You can only compile source files into class files.
sumedha vangury
Greenhorn

Joined: Jun 17, 2012
Posts: 29
Thankyou.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: update jar file