I have a web application, precisely Cyclos SMS mobile banking software that I need to edit some of the .jar files. I imported it as a .war file into Eclipse, edited the .java file that I wanted to, run clean; when I try to check the .jar file that needed to be updated with this change with jd-gui, I see that nothing has changed in it.
So I decided to edit the .jar file by decompiling it with jd-gui, and saving it to it source file; edited the .java file I wanted to edit by importing it into Eclipse; exported it as a .war file and substituted .jar for .war.
I decided to view the changes made, but in the file I edited, I saw that it tried to call other classes in other .jar files of the whole Cyclos SMS web app but could not see them, so it only compiled with errors. How do I edit the whole Cyclos SMS web app, since it has many .jar files, and just working on one of them at a time and recompiling it alone without compiling the entire web app will always lead to errors.
To simply put the question again, how to I edit .jar files in a big web app?
Try reading the Cyclos download page http://www.cyclos.org/download, looks like sources are available. Try downloading the source code and modifying it
Related
So I am struggling to package my program into a .jar file due to the use of external libraries (Poi apache).
However, after trying to build the project into a jar file, I get this message (See title and pic).
I have tried deleting my.IDEA folder and tried to reimport, but the problem is that when I delete my.IDEA folder I also lose my external libraries which my program depends on, and therefore it becomes a cycle where I have to reinstall the java-libraries again which then creates the.IDEA folder as a result
I'm kinda new to spring and web development as a whole.
My question is:
When you build a spring boot project (using Maven) into jar file and deploy it via Docker, everything is in one jar file. How can you access your resources (css, js, images, html...) if you want to edit something? Like change something in css file or add something to html page. Is it even possible? Or do you have to build a new jar file everytime, when you need to change something (in frontend)? Also, when there are being uploaded some images or other files, where are they stored? This stuff is very confusing for me and i can't find any related books or help at all.
Thanks for help!
when you package any java program it is nothing but a zip file. Based on what kind of package it is, you wither name it as a Jar or War.
Jar == Java archive
War == Web archive
Now, given the fact that jar and war both are essentially a zip archive, it gives you flexibility to extract and modify them just like any other zip file.
On windows, I think softwares like 7zip let you update the jar inline. I have done it multiple times, especially when I wanted to change application.properties alone on cloud machines, and no other code changes were required. In such cases, building the whole jar and transferring it again to cloud machine could be time consuming. So I would just extract the contents, update whatever I want to, and rezip the package.
Here is the commands you can use -
jar xf jar-file
This should extract the files into a directory.
This SO thread will guide you towards creating jar files.
Something like jar cf myJar.jar ** should be enough to generate a jar file IMO, but syntax might vary.
The jar file is actually just a zip file containing all the files and classes of your application, so technically you can change files in it like any other zip archive. Best practice is to build the jar file using Maven or Gradle from source every time you need something changed.
It's good practice to keep the source in version control using Git, and tag each build in the git repository - that way you can easily keep track of changes to the jar file by looking at what's in git at the time of the build.
I have a question, perhaps it was already answered, but i didn't manage to find it and I appologize if the solution already exists (let me know if it is before deleting my thread).
Problem is:
I have created a program on another PC and exported it from eclipse as a .jar file. It works on my main PC when I double click on it but when I import it in Eclipse I can't find the .java file. So i can't edit it.
What I have done so far:
In eclipse I have created a new empty project
I have right clicked,import, archive file, selected the .class files that eclipse sees, but when I am in the Project Explorer in Eclipse I can't find the .java file where the main is. I mean I can click run as a program and it works, but there is no .java file, only .class files. What am I doing wrong?
That cranes.class should be cranes.java. At least on my other PC it is.
Program works fine, but I can't edit it on my main PC. What am I doing wrong?
Thanks and best regards
You need to select the Export Java source files and resources option while creating the jar file and then your Java files will be available on importing the project from the jar file.
This is similar to how you use other libraries. You depend on the Jar file which contains class bytecode (compiled) of java code. You can't edit any of such files directly in the project you are using it. Thought you can always extends functionalities in your current project using simple inheritance concepts.
If you think such functionalities are trivial you should prefer to change in the original project rebuild the jar and use the newer version of jar.
However if you feel similar things for 3rd party library you can
always make changes after taking fork from those library source
code (if open source) and build and use your own version or go
ahead and raise pull request if you are confident about your
changes.
Mostly when you build a jar file, all you have in it are .class files; these are the result of compiling .java files, and so are not editable with text editors.
You CAN create a jar file that contains .java (also known as source) files, and even a jar file that contains both .java and .class files, but if you ask eclipse to create a jar file, by default it is just going to put .class files and files from resource folders in it, not .java files.
Assuming from the question, the jar is a library created by OP, by compiling java files into class files and packing/exporting them. Although the class files can't be edited in any IDE, they can be de-compiled into Java files by using third-party applications.
I personally use IntelliJ for this de-compiling source files authored by me
Note: Although this gives OP the desired functionality, it may lead to violations if the classes are Copyrighted.
As IntelliJ states, they neither encourage nor discourage de-compiling class files and the decision is purely to the user's discretion.
EDIT: It is always recommended to use the original source files for editing. Try to host them on git so that it may be retrieved anytime required
It may be simpler to not use eclipse but jar/zip/tar your project directory on the one computer and simply extract it onto the other, then open that folder as a new project in Eclipse.
Best is the suggestion from #SanjayBharathi to use git and clone the repo on your other machine.
I'm running jdk 1.8_191
I created an JavaFX application.
I tested it in IDE, everything runs well.
I created an exe Artifact, I get errors when loading FXML's.
Solved it tho by putting my FXML files and Java files in one folder like this
used to put FXML files in that empty view folder and run my code like this
but I get errors only in generated exe Artifact. Runs smoothly in IDE (IntelliJ).
My question is why? I'd like to separate my FXML files and JAVA files for neatness and better readability. Why does it only work if both files are in the same folder in Artifact, but works separated in IDE? is this just the way it should be?
P.S. I've also read that I must place my FXML under "resources" folder but it didn't work as well (in Artifact). What am I missing? thanks!
I'm working on a java app. I created a jar file and after that I made some changes in my code about look and feel of app using Net-beans but the changes I made are not reflecting in the jar file. So do I have to delete the old jar file and then create a new one?
You need to re-make you jar file again, the jar file is essentially a compressed file containing all the resources (classes, images, etc) required to run your program. So if any of your classes changed you need to recreate the jar file to ensure the updated classes are incorporated.