Spring access saved file without restarting [closed] - java

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
A file is generated dynamically at run time through one of the methods and is persisted in resources. As soon as the file is generated, the server automatically restarts as it detects a change in the File System.
Although, I know it's an anti pattern to save the file in the project directory itself, but the project demands of such feature and there is no escape at the moment.
Is there any way to prevent the restart of the server if any of the files are generated / modified specifically in resources; i.e. Ignoring the resources directory.
Build tool is Maven and editor: Intellij.
Can spring-boot-devtools be the reason for the restart? I tried adding spring.devtools.restart.enabled: false in property.yml file but without any luck.

I think you should save the file somewhere outside your project mainly because resource folder is a standard maven folder and it's bundled into the war when you deploy. When you save a file it's saved into the file system only. However the file won't be available in your already packaged war bundle. That's why you are able to see the files after you restart, they will be bundled into the new war every time you restart because maven recompiles them and put them into new war.

Related

How can I get an eclipse project to reference source jars from maven local repository in a shared project? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I'm currently working on a large shared project consisting of many smaller sub-projects. Recently the team migrated the build system to maven, however we currently have no source/javadoc information showing up in the eclipse editor for any of our referenced libraries.
I've been looking into a solution and gotten pretty far, with the maven dependency plugin I was able to copy source jars from my maven local repository into a shared folder one level above the sub-projects. I then used a linked folder in the sub-projects to reference the shared source jars folder. Finally I referenced the local linked folder from the .classpath files of each sub-project. This could all be done in a relative manner by making use of various variables.
I'm wondering now, if there's an even better way to do it. If I can create a linked folder in each project that goes straight to the maven local repository then I can eliminate the need to create an extra copy of all the source jars.
So far I have been unable to figure out a way to do this without specifying an absolute path, or making assumptions about the location of the maven local repository relative to the workspace directory (or something similar).
You don't need to do any of this.
If you use a jar as a <dependency> in Maven, then Eclipse automatically finds the x-sources.jar that lies next to the dependency.
So if you build a project with attached sources jar and then use it in another Maven project, the sources jar is found without further configuration.

C# pack.xz garbage after end of pack archive [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
I have a C# program that should download a file from the internet and extract it.
The file is a .pack.xz file, i have no problem extracting the .xz, i tried even manually checking the checksum of the file and it was downloaded correctly.
For instance, one of the files i have to download is this:
http://files.minecraftforge.net/maven/com/typesafe/akka/akka-actor_2.11/2.3.3/akka-actor_2.11-2.3.3.jar.pack.xz
I downloaded it from the browser, then extracted the .xz part with 7zip and it was ok. Now i have a .pack file, i tried to unpack it with Java's unpack200 but it says me "garbage after end of pack archive".
It extracts the file anyway but it's corrupted infact if i open it with winrar it says unexpected end of archive. The jar file i extracted was 2,350,874 bytes while it should have been 2,553,197 bytes.
I really don't know how to solve it. I even checked some online programs but they seems to do the same thing i do the same way i do it so i can't figure out what's the problem
As a workaround, you can grab this JAR from a different Maven repository, such as the Central Repository (which has this specific JAR and a bunch of newer versions). See this search to find all the versions. The older version in your original link is on the second page of this search (although it may be less functional or less secure than the latest version).

Eclipse does not recognize code changes [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Just note that I am looking for possible solutions for more then couple of hours. I saw similar problems on Stack Overflow but this just not work.
Ok so I have created a Dynamic Web Project in Eclipse Kepler. Later I shared everything with my team mate. Problem arises when he is trying to change one of the classes. He changed private field to something else. But when he restart tomcat server republish code he got an exception that path to the file is invalid. But he changed that!!!
Eclipse still thinks that variable has an old value.
Any idea how to fix it? We restarted eclipse multiple times, restarted tomcat server.
Make sure Eclipse actually builds the class file. JSP files are compiled by the web server at runtime, so changes there might work.
Look at the file system, make sure that the time stamps of all the .class files change when you save a change in Eclipse.
What do you mean by shared? If you are using some sort of source control application, the problem is most likely there. Quick fix if you are pressed for time would be just copying the entire project directory, and creating a project from said directory. Also, tomcat has a tendency to not 'update' your deployed project for some reason. If, however, you kill the work/catalina folder and re deploy your project it should work.
Remove the project from your container, clean the container and redeploy the project

How to make a standalone application in java [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I use eclipse to run my java code, but I want to make an application that won't use eclipse to run. I want to make it work as a portable stand alone application that only uses the libraries I need.
Right click on Projectfolder (in Eclipse) -> Export -> Java -> runnable JAR -> choose class with main method. Done ;)
I'm going to assume you mean to create a .exe file. for this you'll need a .jar file.
I'm not familiar with Eclipse I know that Netbeans makes the .jar file automatically once the code is compiled.
(For Netbeans)
This .jar file can be found in the dist folder. In case there is none see here to fix that.
In case Eclipse puts into a different folder I'd just look in all the folders related to the project until you find a file with a .jar extension.
Once you have the .jar file you'll need to run an application to change it from .jar to .exe , I would recommend Launch4j.
Here's a handy tutorial to help you with that application if you get stuck.
I know this isn't exactly the answer you're looking for but it's close! Hope this helps!

How to remove obsolete java classfiles? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
Every time I need to delete the previous files to force the compiler not cache
I compile it using:
javac Main.java
and other imported files are nor compiled, until deleted
Of course you don't want ALL imported classes to be deleted (java.lang?) but only your project. Simple: Delete all .class files in your output folder, recursively, with your shell's tools. If you have a dedicated output folder you can just delete the whole folder.
Best method: Learn a build tool like Maven or Ant and use the integrated ways to clean a project output, e.g. with Maven mvn clean. Or if you use an IDE with a built-in builder (e.g. Eclipse) there might be a clean option for the project.
This is not a "cache" in a strict sense.

Categories

Resources