Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

update jar file

 
sumedha vangury
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ?
 
sumedha vangury
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2957
59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No. You can only compile source files into class files.
 
sumedha vangury
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thankyou.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic