GeeCON Prague 2014*
The moose likes Beginning Java and the fly likes How how compile source files of .jar File? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How how compile source files of .jar File?" Watch "How how compile source files of .jar File?" New topic
Author

How how compile source files of .jar File?

Bhavik Goswami
Greenhorn

Joined: Jun 21, 2012
Posts: 9
I have one souce of .jar file now i want to change in .jar file and then i want to use it. but for that i have to compile it. so can you guide me how to compile this jar file folder.

Thanks,
Bhavik
Hitesh Patel Patel
Greenhorn

Joined: Jul 23, 2009
Posts: 27
As you know .jar file is combination of one or many class files. So if any of your JAVA file source changed then you need to compile that one NOT the .jar file.
Once you compile the desired java file into .class file then just create the .jar file again.

Here is the good link about it:
http://www.mathwarehouse.com/programming/java/how-to-create-runnable-jar-file.php

Thanks,
Hitesh Patel
Sydney
Bhavik Goswami
Greenhorn

Joined: Jun 21, 2012
Posts: 9
I have a jar file with a number of .java files in it. I have extracted the .jar file and changed in some files.
I would like to compile all the files in it into class files and save them all with retaining the existing
directory structure in the sources.jar file. Any idea how to do this?
Hitesh Patel Patel
Greenhorn

Joined: Jul 23, 2009
Posts: 27
One thing you should understand that JAR file cannot be complied rather it can be created.
So if files within your JAR are changed then you need to compile either on command prompt OR use eclipse / netbeans. Then later just overwrite / create new jar to different location with the same name.

I hope this will help you.
Bhavik Goswami
Greenhorn

Joined: Jun 21, 2012
Posts: 9
how can i compile this mutiple java files in different subfolders using eclipse or any other easy way. i want to remain existing folder sturcture.

Thanks,
Bhavik
Stuart A. Burkett
Ranch Hand

Joined: May 30, 2012
Posts: 679
You create a project in Eclipse, add the .java files to the project and build the project. It will even build the jar file for you.
If you don't know how to do any of those parts then you need to read an Eclipse tutorial and/or their help pages. Nobody here is going to tell you how to do something when detailed instructions are readily available on the internet. You need to ShowSomeEffort. If you then have a specific question about any part of the process, people here will be glad to help.
 
GeeCON Prague 2014
 
subject: How how compile source files of .jar File?