Can Visual Studio Code incrementally compile a Java web app project? - java

I'm new to Visual Studio Code. I'm trying to use it with an existing Java web app project that uses Maven. I've downloaded the recommended Java extensions like Java Extension Pack, Maven for Java, and Tomcat for Java.
In IntelliJ (my usual IDE), I can go from a small Java edit to refreshed WAR in Tomcat, pretty quickly. If I edit a file and recompile the project, it only works on a few class files, and then updates an exploded WAR directory. Then you have an option with Tomcat to restart, redeploy, or simply reload resources (like JSPs). This process means that for most changes I don't have to wait long to see the results in Tomcat and my browser.
In contrast, all I know how to do in VS Code is run a maven command to package a WAR. It takes too long. Is there something like the IntelliJ process above, where it can use the Maven pom.xml for library info but do incremental/update builds and put the classes in the exploded war?

Edit : nota solution :
From https://www.reddit.com/r/java/comments/77n6qa/jrebel_rant_alternatives/?sort=confidence
DCEVM and HotswapAgent
http://dcevm.github.io/
http://hotswapagent.org/
I'm not sure how this compares to JRebel as we've never had the budget
for such software, but for free, I was very impressed.

Related

Deploying a NetBeans application with JavaFX

I am attempting to build an application in NetBeans that can be deployed to and end user. I am still pretty new to deploying projects and this is by far the most complicated one I have done so please bear with me. I currently have a working application in NetBeans which utilizes JDK 15 and JavaFX 15. As long as I run things inside of NetBeans everything works as intended. I have reached a point where I want to make sure I can distribute this application outside of NetBeans. To this end I did some searching and found the following tutorial.
https://netbeans.org/kb/articles/javase-deploy.html
I was able to follow the tutorial and build the example. The build works in NetBeans, I am able to run the executable jar file in the dist folder from the command line, and I am able to run the jar file by executing it from the file explorer. Now when I attempt to do the same process with my own project I run into the following errors.
When I attempt to run the jar file in the dist folder absolutely nothing happens.
When I attempt to run the jar file from the command line using the command
java -jar "C:\Workspace\HandyAndyVersion1_2\dist\HandyAndyVersion1_2.jar"
I receive the following error,
Error: JavaFX runtime components are missing, and are required to run this application.
I am currently under the assumption that the first problem is a by product of the second. If anybody has a solution to this problem or any ideas on what I could have configured wrong please let me know and thank you all in advance.
To package a Java desktop application these days, you should be using the jpackage tool and optionally the jlink tool. These will generate a JRE image that is packaged with the application and contains the modules you need.
I suspect the issue you are running into is that the native libraries for JavaFX are not present. Most distributions of JDK 15 do not contain the JavaFX modules, though some do. (See the Full and FX bundles of the JDK from Azul and Bellsoft). I find it is easier to use a JDK with JavaFX bundled rather than have to manage a separate module path during development for the jmod files of JavaFX, but that is another option. Either method can be used with jlink to create a suitable JRE for your application that includes the JavaFX modules.

Axis2 issue with version of Axis Kernel - how to reference another project from your java project

1) I have old project that I need to modify. I need to add new web service. And I am having issues with some jar files.
I have created new service (Axis2), then I used Eclipse wizard to create Web Service Client code. Everything looks fine, except when my MyServiceStub.java showed up inside client java project, it failed to find some libraries.
I looked at few of them and it seems it is looking for Axis2-kernel-1.6.0.jar. Currently in my old project I see Axis2-kernel-1.3.0.jar and it seems that existing OtherServiceStub.java file there is using this Axis2-kernel-1.3.0.jar.
The first thing that dropped on my mind is that previously web services were created with earlier version of Axis2. My current version is 1.6.
The thing, I really don't understand is why in Project Facets it is telling me that Axis2 is of version 1.1....
Ideally, I would like to use Axis2-kernerl-1.3.0.jar, becase I want to keep changes to minimum. What Version of Axis2 do I need?
Any advice how to solve my problem?
And ...
2) If I have 2 projects, how can I automatically reference JAR of one project in another one, so when I make changes in referenced project, I see them effective when runing in project that is referencing? Right now, I export project to JAR, then I manually copy JAR (overwrite) to folder of the project that needs it.
1) You need to use whatever version of the kernel axis2 web service is currently running, ie wherever this is deployed to has a kernel version. You want your client code to talk to the server in the same version of axis basically.
You can download old releases here
http://axis.apache.org/axis2/java/core/download.cgi
2) Running vs debugging is different. If you are running axis2 on a server, not inside of eclipse, your best option is to export the jar and upload to the axis2 WEB-INF/lib directory. That way you can have a copy you debug and code upon, separate from the copy that is actually running.

deploying a java web project from local mac computer to linux server

I am wondering how I can quickly deploy the java dynamic web project that I built using eclipse on my mac to my Linode linux server? I already have a wordpress website running on the server and have also downloaded tomcat V6 and eclipse. Would I be able to manually copy the source, build and WebContent file contents? I would like to learn best practices for application deployment in the future but this project is very simple and I would like to be able to make it live as soon as possible. If you could also recommend any step by step tutorials I would really appreciate it.
thanks so much
Timnit
You should consider to build a WAR. Eclipse is just an IDE, it helps to develop, not to deploy.
Build your war (you can use maven/ant/build it from eclipse) - whatever you chose.
Once its ready your "deployment task" becomes a matter of moving a single file from MAC to linux server.
Use Cargo. See how easily it can be integrated with Maven build. Here is an excellent blog post.

How to do Java web development without a local environment

I started a new job recently. I've been a Java & XML web developer for two years. The new place I'm at has several large web applications, but none of them deploy to my local JBOSS server because some genius decided to create a Java Project instead of a Dynamic Web Project. I tried following the steps to convert the project but that creates a bunch of errors which I cannot resolve.
The people I work with are all consultants and never give me a straight answer on how I can develop/test my changes locally.
Has anyone had to program in a similar situation? If so... got any advice?
I've worked on projects like that, but with Tomcat as the server instead of JBoss. I develop in Eclipse using a normal Java project, and I follow these steps:
Run an Ant script to build the project into a new WAR in a temp workspace directory.
Use an Eclipse plugin to stop the local test server.
Run an Ant script to copy the WAR to the proper directory for Tomcat to pick it up and deploy it.
Use an Eclipse plugin to start the local test server.
Tomcat's fast and the project isn't huge, so this whole process takes 12-15 seconds. With JBoss being a full enterprise app server, I'd think it might take more time.

Importing Liferay portlet into Eclipse IDE

I have a question regarding the development of liferay portlets using the liferay plugin SDK. My question goes mainly in the setup of the development IDE. The suggested one would be to use Netbeans IDE which I also tried out, but it appears to run very slowly on my machine while Eclipse is quite performant.
The setup for Netbeans IDE is the following
Go to the directory \portlets
Run the create.bat (or sh file depending on the OS) to create a new sample portlet
Run Netbeans IDE, create a new "Java free form project" and point it to the directory of the created sample portlet
That's it, pretty simple.
For the mentioned reasons above (and because I'm a lot more familiar with Eclipse) I'd like to import the project into Eclipse the same way. Is there a way for doing it without having to change too much in the original structure of the created sample portlet and the according build.xml (ant file)?? I tried already to create a new project out of the build.xml ant file of the created sample portlet, however in this way it doesn't include me the source code.
I didn't also find great tutorials on the web...
Could someone help me with this, pointing out online tutorials or give me some hints.
Thanks
I know your pain. Starting to work with Liferay needs much time. I you do not want to edit the existing source, but only crate your own portlets, you can download the plugins SDK from the 'Additional Files' section on the Liferay website. This provides ant scripts, to create a simple JSR compliant portlet, and to create all necessary things, to create a sound Eclipse project, for example:
ant -Dportlet.name=<project name> -Dportlet.display.name="<portlet title>" create
Than cd into the directory of your created portlet an do:
ant setup-eclipse
After that you should be able to create a new project from the sources in that directory in Eclipse, which can then be deployed via another ant script to the running tomcat instance. If you already know somthing about portlet programming, you shoud be pretty much settled now. If not, try to find documentation about JSR portlet programming first, before looking into Liferay specifig portlet development.
Liferay has now released an official set of Eclipse plugins that support portlet development. Here is the installation guide for installing the eclipse plugins:
Liferay IDE Installation Guide
Also there is a getting started guide that shows what to do after installation to actually setting up your first portlet project.
Getting Started Tutorial
Liferay IDE uses the Plugins SDK from Liferay under the covers to do all the work. If you already have existing projects that you created with the Plugins SDK those can be imported into Liferay IDE as well.
Importing existing Projects
you can find the tutorial for deploying liferay in eclipse
http://www.liferay.com/web/guest/community/wiki/-/wiki/Main/Development+Environment+(Windows)
No clue about Liferay's specifics, but in general, I'd do this:
Follow the steps 1 and 2 from your NB setup list
Create a new Dynamic web project (or a Java project if you don't need the web project's features) in Eclipse
Import the contents of sample portlet directory by doing Import -> File system in Eclipse
Adjust the project's Java source directory to point to the generated sample portlet source directory (that should now appear in your project)
Adjust classpath of the project, point it to LR lib folders, ...
If there's a generated build.xml, check if it can be used to deploy to LR, or to produce builds.
As of March 2011, there is some official Liferay support for NetBeans and as noted before, there is official support for Eclipse ( In the Marketplace). The Documentarian uses Eclipse himself, though many examples just use the Plugins-SDK with shell scripts, ant scripts and no IDE.
We are fighting with Liferay on Eclipse, Eclipse seems buggy and unpredictable, but we are also new to J2EE and Eclipse ( so discount this last comment a bit), and I have our portlet files setup in a separate area for SVN, requiring a refactor-move, refactor is definitely buggy.
You should be aware that there is a book for developers on the way from the official documentarian - we've bought the early release and found it useful. He does cover some IDE issues. See Manning press.
The Liferay sample portlets ( there are many) are not set up for Eclipse projects, and you'll have to import some java files and jump through some Eclipse hoops to get them into a running Eclipse project you can develop.

Categories

Resources