I am looking to setup this project ( https://github.com/afawcett/githubsfdeploy) on my local machine. I'm not too familiar with Java but I feel I've been able to do enough (MAVEN, JAVA environment downloads and system variable settings) to get my windows machine up and running along with Visual Studio Code. I was able to get the spring boot project up and running in visual studio code without any issues so I want to believe I have all the required pieces (https://code.visualstudio.com/docs/java/java-spring-boot).
The spring-boot project has a main method and the one I'm trying to recreate doesn't. I am receiving the error when debugging the githubsfdeploy project that a "main" method could not be found. I've been researching other ways to run a java project without using the main method but haven't recognized the missing piece yet. Would love some direction on what I may not be taking into account. Thanks!
This is a Maven project which based on the concept of a project object model (POM). So first, you should download Maven and Tomcat locally.
My machine: win10, vscode1.49.0, JDK11
VS Code Extension installed: Java Extension Pack, Tomcat for java
and i download: apache-maven-3.6.3-bin.zip and Tomcat9.0.38 and extract them
Add maven to Environment Variables:
---\apache-maven-3.6.3-bin\apache-maven-3.6.3\bin
Open the project in VS Code, add the following code in User settings.json:
"maven.executable.path": "---\apache-maven-3.6.3-bin\apache-maven-3.6.3\bin\mvn",
Follow the picture steps:
Add the tomcat server and run the .war on tomcat, here is a gif tutorial: work with tomcat
Finally, you will observe this result:
When you can run it successfully, debugging is achievable: right click the tomcat server and choose debug war packages:
Related
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.
I am trying to configure Grails in Netbeans.
Grails version:3.2
Netbeans: 8.2
JDK: 1.8
OS: Windows 10
I have install and configured environment path and other stuffs. I can create and run project from the Command Prompt. But I can not create project from netbeans.
Warning |
Unrecognized flag: non-interactive.
Error |
Specify an application name or use --inplace to create an application in the current directory
This error is showing, to create project from Netbeans. I can run the created project though. I have already added Groovy plugin.
How can I solve this problem?
I don't think you are doing anything incorrectly. I have an environment very similar to yours (Grails version: 3.3.2, Netbeans: 8.2, JDK: 8u151, OS: Windows 10) and I see the same error: Specify an application name or use --inplace...
This is a known issue with NetBeans 8.2 that has already been bug reported; see Bug 258407 - Error when creating a Grails 3.1.x project. The problem has been confirmed to exist in Grails releases 3.1.0 up to 3.1.4, but I see the same issue in 3.3.2, and there is no fix for NetBeans 8.2.
However, I successfully created a Groovy/Grails application using JDK 8u151 with a DEV release of NetBeans which you can download from here: http://bits.netbeans.org/download/trunk/nightly/latest/
Note the caveat that comes with using DEV releases of NetBeans:
These builds are still under development and could contain defects
that lead to data loss. They are meant for evaluation of new features.
As always, be sure to back up your changes if you use these builds on
your production code.
As long as you can you can live with that situation, using a DEV release is your (only) solution for creating Grails 3.x applications in NetBeans.
One final point: unlike NetBeans 8.2, DEV releases of NetBeans support Java 9 as well as Java 8, but don't use Java 9 when creating a Groovy/Grails applications. It won't work for a completely unrelated reason.
I'm using Windows 8 and Grails 3.3.8, but the following worked for me:
Create the project using system command line (I used instructions in this page: how to create grails project through windows command promt).
Import the project to Netbeans 8.2 by clicking on File > Open Project... and selecting the project folder.
This solution works for me (Mac OS)
1) Open de console inside Netbeans
2) Navigate to your GRAILS_HOME/bin
3) Type grails create-app [YOUR_NAME_APP] --profile=web (rest-api, etc)
4) The project must be created at GRAILS_HOME/bin/[YOUR_NAME_APP]
5) Do not try to import into Netbeans instead of it Open the project
6) Start coding!
You can move the folder GRAILS_HOME/bin/[YOUR_NAME_APP] to the Netbeans workspace before open the project.
FYI, I am using netbeans 9 and grails 3.3.8 (dont use 3.3.9, its broken), and it works like a dream. I can create domain classes etc. from the menus in netbeans, run, debug etc. THe only thing I had to do was manually install the grails plugin for netbeans, and configure my grails paths etc. The answer on how to set this up is here: how to open a grails 3.3 app in netbeans 9?
The only thing I cant get to work (and its a bit of a show stopper), is multi-module projects (i.e. a grails app which depends on a grails plugin). I can run them, but netbeans does not recognise any of the imports so there is no code completion and it shows all files are having errors. What a shame, as appart from this, netbeans has very good grails support.
Note, I always create projects on the command line, e.g. "grails create-app myapp ...", then simply use the open project menu in netbeans and it instantly recognises them as grails.
Ensure you have gradle plugin installed for netbeans. Then go to File -> Open Project.
You should see the project shown by netbeans as a gradle project.
I am using IntelliJ version 14.1.4 on Windows 7 64bit with oracle JDK 1.8.45.
When I change a method logic etc and click on "reload changed classes" from run menu, I get following error-
I've tried running IntelliJ as admin also, invalidating cache but that doesn't seem to help.
Note that I am using Jetty maven plugin to run my web application.
As suggested by #HeathMalmstrom, Jetty maven plugin doesn't play nice when trying to reload changed classes. What I did was instead of using Jetty maven plugin, I wrote a class with a main method which embeds Jetty; now I run this class under debugger and everything works fine.
i have a little vaadin project for a school project that originally deployed well and worked.
i am using jboss as 7.1.1, vaadin7 and jdk8. My target platform is a raspberry pi running raspbian os.
so i am using the pi4j library to access the gpio interface of the raspberry and everything worked just fine until i implemented a check for null when creating a new instance of the web page. at first the error was because somehow the "jboss/standalone/deployments/roboterarm.war/WEB-INF/..../classes" directory became empty. afterwards the error came to eclipse as i could not use the pi4j library anymore. i did not touch the libraries and i can't figure out why it suddenly stopped working. i reinstalled eclipse, jboss and redownloaded all the libraries but i still can not use anything, not even in normal java applications!
afterwards i grabbed a copy from SVN that used to work normally but no luck there either, i can not use the pi4j jar-files.
everything looks fine to me there, yet it fails to give me code completion or compilation
i also tried creating a new vaadin project and c&p'ing the source code into the new project but the jar files are not recognized there either.
What am i doing wrong? how can i fix this? thanks in advance!
Eclipse buildpath, clearly indicates that your JRE is not properly added. Add your JRE to your build path, using the option Add Library.
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.