Eclipse: Auto-load html/JS changes during debug - java

I am running an app in Java Spark Framework. I run it in Eclipse with Debug-As->Java App. This successfully deploys the changes to the Java files. That is, I save a Java file, and Eclipse compiles it, and the running app reflects the changes to the Java file.
Spark uses an embedded Jetty server under the hood, so this is just like running a embedded Jetty app in Eclipse.
Anyone aware of a good way to cause the HTML and JS changes to also be auto-deployed?

In order to auto update the static files of your project, you can reference them as external static files. You're probably doing this:
staticFileLocation("relative-path-to-html-and-js");
Instead of the above, do the following for debug purposes:
externalStaticFileLocation("absolute-path-to-html-and-js");
By doing so, when you press F5 in your browser, you're going to get all your changes to html and js code shown. It's even unnecessary to restart de debugger. Restart the debugger just in case you modified your Java code.

Related

Is there a way to use NetBeans's deploy on save within local LAN (JAVA Servlet)

I am working on a Java servlet project using NetBeans.
I am looking for a way to use NetBeans’s “deploy on save” on another browser of my device within LAN (locally its working fine) so that I don’t have to manually reload my browser during my development.
Recently I have decided to use proxy feature of Browsersync, but the problem of the Browsersync is, it auto reloads browser early before NetBeans completes deployment on save.
I am using GlassFish(4.1) with NetBeans.
Any help is greatly appreciated.
I had to something different in order to achieve the solution.
I am watching “glassfish/domains/domain1/config/” folder using Browsersync. Looks like after building the project, few files modified here during hot reload (so I have used watchEvents from Browsersync).
The proxy site instantly reload after NetBeans completes deployment on save.
Following is the Browsersync command.
These directory names have to be the full path with drive letter.
browser-sync start --proxy "http://localhost:8080/test" --files "src/java/com/test/, glassfish/domains/domain1/config/" --watchEvents add change " src/java/com/test/, glassfish/domains/domain1/config/" --no-notify --host 192.168.X.X --port 5000

How to debug a Java project's JavaScript files inside Netbeans 8 itself ?

In Netbeans 8: a new HTML5 project using AngularJS online template lets me runs the html files with the debugger attached to browser and I can set breakpoints inside Netbeans JavaScript files to debug. Which makes things ALOT easier.
But when I create a Java maven based web project with AngularJS dependencies I have to use the browser's code viewer to debug the Javascript code. Which is more time consuming.
How can I debug JavaScript files inside Netbeans instead of debugging in the browser for a Java maven based web project ?
You don't / can't directly. While it is possible to run a Java based Javascript interpreter you won't have access to any browser windows or DOM elements. Instead, you almost certainly want to use EmbeddedBrowser to launch and control Firefox, Safari and/or IE depending on which you wish to test with in Netbeans. Note that it's running an external process to do this, and I don't think you'll be able to access the browser developer tools from within the embedded environment (which is what I normally use when debugging Javascript).

How to avoid installing the configuration files of a swing application in every computer in the network?

I have a swing application that is installed in the server, and to access it, I have created a short-cut in every computer in the network, and it's working just fine. The application uses jrxml files to generate documents, and they are packaged in a folder called Cycloplan and its working fine, but I still have some technical issues, in which every time I make some updates in the configuration files, I have to go to every computer and paste the Cycloplan folder to it, so I am looking for a method to avoid this operation when an update shows up. please help.
Package the .jrxml files into Jars and deploy the lot using Java Web Start. They will be updated automatically when the Jar is updated.

gwt java script module not loading - blank page

It seems when I manually build my gwt app, and run it on jetty, i get a blank page. I could add tags within the html document and see its content (ex add a table, i would see a table). But it seems like the modules javascript is never loaded.
This would be the command I manually run: mvn gwt:compile jetty:run
When I run my app on GWT Development Mode using their IDE, everything shows up as expected, I see my module being loaded and its contents.
Note I am using the RootLayoutPanel, would I be required to use UI binding?
If Development Mode works but compiled & deployed files do not, well, it looks like a deployment issue. To check, get Firebug for Firefox (or the equivalent tool for your preferred web browser), and check the HTTP requests made when the page is loading - you will probably find that some requests are 404, and that GWT compiles JS hasn't been copied over to the proper spot.

How to enforce Tomcat (deployed in eclipse) to automatically reload a changed file

I am writing a java web-application program to create a file(a simple xml file) in hard disk. The program can update the file dynamically. After its creation/update, I want to see the contents of that file from another application(e.g. browser). The problem is that the browser is not aware of the new modifications made in the file. This is resolved if I refresh the eclipse project manually(However, I want the browser to see updated file contents each time I refresh the browser after the file is modified within the web application). So, I think there's some issue with Tomcat/java not releasing the handle of the file or maintaining cache.
Please suggest.
No, the issue is not with Tomcat. It's with Eclipse. You must refresh your eclipse project vs the project directory on disk.
The alternative is to use external Tomcat (or Jetty) for testing your webapp.
Set Response no-cache headers.

Categories

Resources