I want to create a self-updating jar.
I've got the first part down: I download the most up to date version. I'd like to delete the current version, though, and that's where I'm stuck. I do the updating at the very end, and I'd like to delete the current jar.
I've tried the File.delete() and the File.deleteOnExit() methods to no avail. Any advice?
Thanks.
Java web start is a good choice for that. A more original method would be to have a very limited core application that relies on other jars that you can upgrade from the core app.
Related
Since I am having a couple of angular projects within the same workspace along with Spring Projects, the Java Language Server that runs for providing Java support to VSCode takes an enormous time (~10 mins) to run through all the contents of the workspace which includes node_modules.
Is there a way/setting that I can use to tell it to skip certain folders/files so that I can speed up the initialization of the Java Language Server? Especially contents of node_modules?
As of v0.66.0 of the extension, there is the java.project.resourceFilters setting. As it defaults to ["node_modules",".git"], your problem should be solved by using a current version of the redhat.java extension.
If you'd like to exclude more folders, you can add them in your settings.json.
#1460 is the matching issue for this question.
--
But: this does not work for me atm. See #1655, my setting seems to be ignored, I'll try to resolve this with the devs and update this answer accordingly.
I am developing an application on xpages, with Domino version 9.0.1 FP8. This is the first application in which I have developed a call to java classes through a one-button SSJS event. But specifically I am consuming a web service using the technique presented in the article. What I noticed is that every time I change something that has a direct relationship with java, such as the java classes created and stored in the java folder of the designer or in the call of the web service method inside the SSJS event, an error is listed below . The only way to solve the problem, at least until now is to restart the Domino server. It's no use clearing the project, rebuilding it, and restarting http.
Does anyone know how to solve this problem? Is there any command on the Domino server that reflects this change? Is there any parameter in the application that I have to configure?
As we can see from the error below, it seems that it does not find the web service client classes that are located in a jar in the application jar folder.
HTTP JVM: java.lang.NullPointerException
HTTP JVM: at com.ibm.domino.xsp.module.nsf.ModuleClassLoader.getResource(ModuleClassLoader.java:206)
To solve your specific issue, issue res task http at the console. There are other workarounds posted in the comments to the main question that may be more practical for your situation though.
As a workaround you can rename the jar file when you make changes to it, import the renamed jar file and delete the old jar file. This way Domino will see the changes in the jar file.
I am using the rename trick whenever I make changes to code assembled in a jar file.
I have with me a working copy of Apache FOP's Java Servlet source code.
I have compiled the code - which handles a doGet request - and deployed it on Tomcat on my localhost, and it works and its good.
BUT I need to add functionality for a POST method to the file.
I can do that, but I'm not sure how to use the source code. All of my experience in Java has basically been behind an IDE.
The servlet is built by an Ant script, build.xml, that seems to contain references to variable names. Do I need to add to this file at all? Can i just change stuff in my servlet.java, and go straight to building?
Yes, you can do that. If you have the source code and can build the project, then you can start a simple text editor, change the servlet Java file and then build the whole thing again.
But it will be time consuming. It can take a while until compilation problem are reported leading to high turnaround times. And you are unable to debug your code if something went wrong.
For some very small changes this approach might be suitable. But for larger changes it would be better to invest the time to configure your IDE for web application debugging.
For a project I am building a Java GUI from which queries can be sent to Neo4j, to make it easier to do particular analyses. To get this all working, I have downloaded a .jar folder containing all relevant classes (neo4j-javadocs-2.1.7-javadoc.jar). I have loaded the library through the project->properties->libraries->Add JAR, but I can't seem to import the classes I want to use in my GUI (neither automatically nor manually).
I am dabbling in Java, so it is probably a basic oversight that I am making, but with the help from tutorials online and trying different commands (like entering the path of the .jar file) I can't get it working. One of these tutorials is specific on the Neo4j library, so I am very confused. That tutorial is written for Eclipse, instead of NetBeans which I am working with, but as far as my knowledge goes that shouldn't matter for the commands
I don't have enough reputation to post direct images, but this link contains a screenshot. If more information is required, let me know. http://i.stack.imgur.com/lUytK.png
Additionally, when I normally add a class that is not imported, there is an automatic function to import the class. This option is missing for my specific class, so maybe I added the library in an incorrect way?
http://i.stack.imgur.com/QeDX4.png
Edit: Issue resolved thanks to a colleague that came in. Apparently I loaded the Javadoc where I should have loaded to individual classes from the lib directory.
It really should work.
Try to save all changes. NetBeans reparses the classes when you save them.
Try to build your project manually from command line using Ant build script
Use Maven, Ivy or Gradle for Dependency Management then you can depend on the Neo4j artifacts.
For sending queries to the server you actually don't need Neo4j artifacts.
You can also use the JDBC driver, see http://neo4j.com/developer/java
I know how to create a jar file using Eclipse.
I was trying to create a share library so that I can avoid redundant source code. I have figured out that a jar should be :-
independent
should not make call to external class attributes(properties)/methods except the standard library imports.
The resources should be given as a parameter to jar file to perform a action.
Should work as a independent entity.
I tried to well organised my code in different packages also added MANIFEST.MF file.
This is first time I'm trying for data abstraction.
I would like to request suggestions/instructions as per the programmer point of view, what are the criteria that jar code should have ?
Is it good idea that my jar is or depend on another jar (viz java mail api jar) ?
Thanks in advance.
As you've tagged this with Android, I assume that Android is the intended use case.
The easiest way to share your code between several projects is probably to create a library project, this way you can keep the source code at hand too (less convenient to attach source to the jar every time you use it).