image won't show in Eclipse dynamic web project - eclipse

I have a folder containing images under WebContent. If I copy file 1.jpg to images using Windows Explorer, it won't show on my webpage:
document.getelementById("image1").src = "./images/1.jpg"
However, if I right click the project in Eclipse, refresh, then everything works.
How do I remove the need to refresh the project? The images are supposed to be generated by another program dynamically

If something outside of Eclipse modifies the workspace it is always necessary to do a refresh.
However you can configure Eclipse to do this automatically in Preferences > General > Workspace. Check the 'Refresh using native hooks or polling' option.
If the program generating the images is an Eclipse plugin it can use Eclipse APIs to create the files or do the refresh (a normal program cannot do this).
If you run the program using Eclipse Run External Tool configuration there is a Refresh tab that will let you set up the refresh to do when the program terminates.

Related

Include Run Configurations in SVN project in MyEclipse

How can I configure MyEclipse and the SVN plugin (Subclipse 4.3.3) so that my Run Configurations are included in the source code control. Every time a new developer checks out the project, he doesn't have the Run Configurations needed to test the application properly or to do the Maven packaging correctly.
Is there a way?
To share your run/launch configuration, go to the launch configuration (Run > Run Configurations...) tab Common for Save as choose Shared file (instead of Local file).
In addition, you can choose to Display in favorites menu to add it to the drop-down of the corresponding button in the main toolbar.

Eclipse not automatically refreshing resources in src/main/resources

In my Eclipse preferences, I have "Refresh using native hooks or polling" selected.
If I make a change to a Java file outside of Eclipse, the project that contains that Java file automatically refreshes and rebuilds that file as it should. However, if I make a change to a file under src/main/resources/... from an external editor, it is not automatically refreshed. I have to select the project and press F5 to get it to refresh.
Is there a way to configure Eclipse to automatically refresh any resources under src/main/resources?
In Eclipse
Run > External Tools > External Tools Configuration
Create a new Program configuration Point the location to an exe that is very fast
On the Refresh tab, choose Refresh Resources upon completion, The Entire Workspace
On the Build tab, deselect Build before launch

LibGDX's HTML project doesn't show anything in Browser

The question is self explanatory, when I run my demo-html project as a Web Application and I open Chrome with the provided link by eclipse, my browser doesn't show the image it is supposed to show in a new project.. However, the tab displays the correct title "Demo". Can somebody help me with this?
Eclipse after Running the project:
And Chrome running the app:
You don't run it as web application. The simplest way is to run
gradle html:superDev
in command line. I'm not very familiar with Eclipse, so here a guide how to run it via IDE from the wiki:
Right click the html project, Run As -> External Tools Configuration. Create a new configuration by double clicking the Program entry in the left sidebar. Give the configuration a name, e.g. GWT SuperDev. Set the location field to the gradlew.bat (Windows) or gradlew (Linux, Mac) file. Set the working directory to the root folder of your project. Specify html:superDev as the Argument. Press 'Apply', then 'Run'. Wait until you see the message The code server is ready. in the console view, then open the URL http://localhost:8080/html. You can leave the server running. If you change code or assets, simply click the SuperDev Refresh button in the browser. This will recompile your app and reload the site.
In IntelliJ you can trivially run the gradle task itself.

How can I refresh the eclipse folder with another tool?

I create a web based project with eclipse and the application server is Tomcat and everything is OK, but I have a few files in specific folder that I should change the content of these files with another development environment that it's created by myself, after I change the file's the eclipse doesn't refresh the file and therefore I must go to eclipse, select the folder, press f5 to refresh it.
My Question is that, How can I refresh that specific folder without doing these steps, for example does eclipse have specific API for refresh the folder?
You can use IResource.refreshLocal to refresh a folder (or file).
One way to use this:
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
IContainer folder = root.getgetContainerForLocation(new Path("folder path"));
folder.refreshLocal(IResource.DEPTH_INFINITE, null);
This must be run in an Eclipse plugin.
Update:
You can tell Eclipse to refresh automatically in Preferences > General > Workspace by checking the 'Refresh using native hooks or polling' option.
There is no way to force a refresh from a program external to Eclipse.

eclipse, refresh files edited by external editor

I currently use emacs to edit .java files and run eclipse.
Eclipse doesn't automatically recognize modified files, so I often end up running unmodified application.
I wonder if there exists a shortcut to refresh all the modified files in eclipse.
Perhaps you want to check Preferences > General > Workspaces > Refresh using native hooks or polling. You can see that the eclipse refreshes the file you edit with external editor (like vi, emacs, etc) when you check the option.
On the project explorer you need to select the project(s) that you want to refresh and then click on File->Refresh or hit F5.