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

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.

Related

how to make eclipse + tomcat instant deploy for webapps

I build a maven project and deploy this war into tomcat webapps folder then started tomcat, so that my app available in browser as localhost:8080/myApp
I can see myApp folder which was extracted from myApp.war under tomcat/webapps.
I can modify this app's UI by editing files undertomcat/webapps/myApp/.. using Notepad++.
I send this project to my co-worker, he also import this project in his eclipse and run this app.
He changed the jsp and js files from eclipse and the result will be reflected in browser, he never used separate editor to this modification.
If I change the files in eclipse then it is not reflected in browser.
What I need to do for the same to be working to me?
If you just want Hot deploy in Eclipse, please try to take following steps:
Double clicks on the Tomcat plugin, refer to publishing tab, make sure Automatically publish when resources change is selected. This should be the default option, to support “hot deploy” resources, for example : JSP, XML and properties files.
In the Tomcat Plugin page, clicks on the Module view, make sure Auto Reload is Disabled. Default is enabled.
Note:
This is an important step, failed to set the auto reload to disabled, the Tomcat server will be restarted every time you modified something!
Start Project in DEBUG mode. Hot Deploy is supported in DEBUG mode only.
Limitation
Hot deploy has supported the code changes in the method implementation only. If you add a new class or a new method, restart is still required.
To simulate it, try to add a new method, following pop up screen will be displayed, saying the code changes cannot be hot swapped in the JVM.

How is the Eclipse sample project "Multipage Editor" supposed to run?

I installed Eclipse Luna in XP yesterday and opened the sample project "Mutlipage Editor". When I click "Run" all that happens is another copy of Eclipse opens looking like the first copy but all the workspace boxes are empty.
I guess I was expecting either an emulator to start or the ability to run it on my Android phone. Can anyone get me started please?
When you run an Eclipse plugin it has to run in an instance of Eclipse so that all the other plugins that the plugin depends on are available.
The default 'Multipage Editor' is associated with a file type (.mpe I think). So create a file with that type and open it to see the editor.
You can also write an Eclipse Rich Client Program (RCP) where you can select the available plugins and the look of the UI, but this requires additional code.

image won't show in Eclipse dynamic web project

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.

How to remove a configuration in Eclipse GWT

I have migrated my application development to a new PC and now when I run the application (Run > Run as > Web application). I get the "HTML Page Selection" popup in which I select my application. However, now I also get a "Choose a launch configuration:" popup which lists "AwardTracker" and "AwardTrackwer.html". They both do the same thing. How do I remove one of these please (this is more annoying than anything else)?
Regards,
Glyn
How to remove a configuration in Eclipse GWT
Simply select any Web Application and click on RED X icon displayed on top right of it to remove an existing configuration.
Once a Web Application is configured then there is no need to create it again. Just launch it from existing one to avoid it choosing a launch configuration again.
Once configured then don't run it again by RIGHT click on the project to run as Web Application. Simply select from the existing one form the tool bar as shown in below screenshots.
Click Run > Run Configurations > your configuration (typically, a name of your HTML or JSP file) > Arguments.
Make sure you only have the path that you want to launch.

Can I link the Zend PDT (eclipse) to a browser action?

Is it possible to configure the Zend PDT debugger in eclipse to hit a breakpoint from a browser action in a similar way to that of the Java debugger for eclipse? I.e. Set a breakpoint, start the debugger, browse a site then drop into a breakpoint when it is hit.
I can debug individual scripts and Web pages however I am trying to debug a script that is called from a webpage. I am using Joomla and want to be able to traverse the dependency stack while click on page content.
Thanks in advance for any advice..!
I found out how to do this but it is quite long winded. It enables you to debug PHP like you debug Java as in you can browser your site and only drop into the debugger when you hit one of your break points. Here's the config for Linux.
Installing Zend Debugger
First you will need to install and configure the Zend Debugger:
Ensure you have the Eclipse PDT (PHP Development Tools) installed. If not:
Add this repository to your sources list in Help > Install New Software...: http://download.eclipse.org/releases/helios
Expand the Programming Languages package and select PHP Development Tools (PDT) SDK Feature.
Click next and install.
Install the Zend PDT in the same way by adding this repository to your sources list: http://downloads.zend.com/pdt
Expand Zend CE Features and select Zend Debugger Feature then click Next.
Restart Eclipse and then go to Window > Preferences > PHP > Debug > Installed Debuggers to ensure the Zend Debugger is installed.
Configure php.ini to point to the ZendDebugger.so file.
First type
php5 -i | grep "Loaded Conf"
into a terminal to find the correct php.ini file you need to edit and open it in a text editor
Next type
locate ZendDebugger.so
into a terminal and copy the location to the php5 Debugger file.
Add these lines to the bottom of your php.ini file:
[Zend]
Zend_extension="[path to your ZendDebugger.so file]"
zend_debugger.allow_hosts="127.0.0.1, [your IP address if required]"
zend_debugger.expose_remotely=always
substituting in the path returned from your locate command and your IP address.
Restart PHP by typing
sudo /etc/init.d/apache2 restart
into a terminal.
Then type the
php5 -m
command into your terminal to ensure the Zend Debugger is properly configured. You will see something like:
xmlreader
xmlwriter
Zend Debugger
zip
zlib
[Zend Modules]
Zend Debugger
near the end of the dump. If you don't see the Zend Debugger then make sure you have edited the correct php.ini file and ensure that the path to your ZendDebugger.so file is valid. Make sure to restart PHP for any changes to propagate.
Configuring Eclipse
Next you will have to configure Eclipse:
Firstly go to Window > Preferences > PHP > PHP Executables and make sure the latest PHP CLI libraries are installed and set as default.
Next add the PHP Debugging perspective in eclipse by going to Window > Open Perspective > Other > PHP Debug.
Now go to Window > Preferences > PHP > Debug and click Configure Project Specific Settings.
Select the project you want to debug and click OK.
Check the Enable project specific settings.
These are the settings you will need:
PHP Debugger: Zend Debugger
Server: [local URL path to your project (should configure this in hosts file)]
PHP Executable: 5.3.x (or later)
Default Base URL / Base Path: /
Auto-generated Base URL: http://[local URL path to your project]
Uncheck the Break at First Line option and click OK to close the config window, then uncheck the same option on the main PHP Debug page. Click Apply to save the settings.
Next go to Window > Preferences > PHP > PHP Servers and add a New server config with the URL
http://[local URL path to your project]
this should be the same URL as in your host config that you use in dev' to get to your home page. Give the config a name and set it as default. Click Finish and OK then restart Eclipse.
Next go to Window > Preferences > General > Web Browser, select Use external web browser and choose a browser you want to interact with during debugging. >Note:> DO NOT USE FIREFOX! The Zend PDT binds to it and you cannot decouple the browser from the debugger without uninstalling and reinstalling firefox. The Opera browser works by far the best with the Zend PDT so here's how to add it:
After installing the Opera browser go to the Window > Preferences > General > Web Browser settings again and select New and use these parameters:
Name: Opera
Location: /usr/bin/opera
Parameter: %URL%
click OK, select Firefox if it exists and remove it then check Opera and click OK.
Restart Eclipse again and you will be ready to start debugging PHP.
Using the Debugger
In the PHP perspective open a PHP file and select Debug as > PHP Web Page either from the Project menu or by selecting the downward arrow beside the Debug icon.
You may see an alert window asking you to confirm the debug URL. Remove eveything after the base URL to leave just:
http://[local URL path to your project]
as the URL and click OK.
If eclipse doesn't switch to the PHP Debug Perspective automatically then switch to it manually.
Go to your browser and navigate to the URL you configured above. You may need to run the debugger forward for the homepage to resolve. Sometimes you will need to refresh and run the debugger forward a couple of times before it fully binds your debug session.
You can navigate site normally and the debugger will drop into your code at breakpoints.
Troubleshooting
When the PHP debug session starts sometimes the session ends before the page loads and the page in the browser stays blank. Try right clicking the session in the debug stack view and select Relaunch.
When a debug session starts up first time make sure the URL in the browser window appears as the base URL you configured i.e. remove any debugger parameters that Zend appends to the URL. URLs should appear cleanly from now on.
For smoother debugging remove all terminated debugging sessions from the PHP Debug perspective before your finish your PHP development.
Be careful to avoid shutting eclipse down while the PHP Debug perspective is in focus as it will take a long time to close.