Showing posts with label Eclipse. Show all posts
Showing posts with label Eclipse. Show all posts

Thursday, February 6, 2014

How to Debug Eclipse Based Application

There are at least two way to do it:
  1. Run your eclipse application from your eclipse development environment in debug mode
  2. Attach to running eclipse application using Eclipse remote debugger 


Run your eclipse application from your eclipse development environment in debug mode


For this option you need to have all sources imported in eclipse development environment and compiled without errors. Then you can just create Eclipse Application launch configuration and run it in debug mode. If for some reason it is not possible, you still can debug your application with second option.


Attach to running eclipse application using Eclipse remote debugger


Using this approach you need to start your eclipse app with remote debugger enabled. Add in your eclipse application ini file following lines in -vmargs part
-Xdebug
-Xrunjdwp:transport=dt_socket,address=8001,server=y,suspend=y
So you would have something like this (note last two lines)
-startup
plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.100.v20110505
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-XX:MaxPermSize=512m
-Xms1024m
-Xmx2048m
-Xdebug
-Xrunjdwp:transport=dt_socket,address=8001,server=y,suspend=y
Now you can start custom eclipse. You won't see anything because it would be in debug mode and wait until remote debugger is attached. When console output shows the message
...
Listening for transport dt_socket at address: 8001
It is time to start remote debugger session in eclipse development environment.
Import source code you want to debug into development workspace. Make sure you use source code eclipse application was built from or line numbers won't match in debug. There is no need to have source compiled without errors because your application is already running.
Select Project->Debug Configurations ... form bar menu and create new Remote Java Application configuration with name you want and configure port as 8001 (see options in ini file above). Do not forget to visit Source tab and add all projects with sources you need during debug session.
Run it ignoring a warning about compilation errors and you should see eclipse splash form your eclipse application started before. After that you can use debugger as usual.

Conclusion


Both options require to have configured development environment in Eclipse, I prefer to use option (2) because it doesn't require to have everything compiled without problems in eclipse workspace. You always can start from what you really interested in and then add missing sources into development environment in the middle of debugging session.

Monday, July 1, 2013

MouseFeed for Eclipse is Your Personal Keyboard Shortcuts Coach

MouseFeed | Eclipse Plugins, Bundles and Products - Eclipse Marketplace: "MouseFeed helps to form a habit of using keyboard shortcuts. When the user clicks on a button or on a menu item, the plugin shows a popup reminding about the key shortcut. After a few times, you remember the keyboard shortcut and you will start using it, rather than clicking through menus. This will save you a lot of time at the end of the day."

It works as advertised and started to show popups for actions selected trough menu right after installation and restart. For example, if  "Run->Run..." menu action selected popup shown below appear.

MouseFeed Plug-in Popup Window look

It also has "Action invocation counter threshold" parameter in preferences, which controls the popup behavior for actions without shortcuts.

MouseFeed Plug-in Preferences

If for example "Help->About Eclipse Platform" menu Item selected 3 times, then this plugin shows popup with link to configure shortcut for it.

MouseFeed Plug-in Popup window look for action without shortcut

For more information look at:




'via Blog this'

Monday, April 30, 2012

JBoss Tools Browser Simulator Standalone Application Build


What is JBoss Tools Browser Simulator (BrowserSim)?

Browsersim is quick and easy way to test how your web application going to look like on mobile device. Truth be told it cannot be 100% reliable and no a replacement for platform specific emulator.

BrowserSim is available as part of JBoss Tools Project, but there is simpler way to get your hand over it and try if it works for you.

How to configure your environment to get BrowserSim running

  • Windows: 
    • Only 32-bit Eclipse/JBDS is supported; 
    • Apple QuickTime or iTunes must be installed (they contain Apple Application Support which provides WebKit engine for BrowserSim). 
  • Linux: 
    • WebKitGTK 1.2.0 or newer must be installed and available in the library load path. 
    • This should be available on RHEL and Ubuntu by default, if not use your package manager to install libwebkitgtk 
  • Mac OS X 
    • It just works. 

What is required to build BrowserSim standalone application

    Install prerequisites listed below:
  • Java SDK 1.6
  • Apache Maven 3.0.X
  • Subversion client

How to build BrowserSim standalone application with maven

mkdir browsersim
cd browsersim
svn checkout https://svn.jboss.org/repos/jbosstools/workspace/dgolovin/org.jboss.tools.browsersim.app
mvn package -Dmaven.repo.local=.m2 -Declipse.p2.mirrors=false
then depending on used platform it can be started as
./target/products/org.jboss.tools.browsersim/linux/gtk/x86_64/browsersim
./target/products/org.jboss.tools.browsersim/linux/gtk/x86/browsersim
and will show iPhone2 skin by default. Use context menu on window title to:
  • select device
  • rotate your device
  • change settings

Wednesday, March 28, 2012

Maven Integration for Web Tools Platform Proposal Posted

Maven Integration for Web Tools Platform (m2e-wtp) is finally on its way home and proposed open source project under the Eclipse Maven Integration project.

Give it a hug if you like it here http://www.eclipse.org/forums/index.php/mv/msg/318532/831379/#msg_831379

M2E_WTP is an extension for M2E which makes your life easier when you import Java EE related projects developed with maven in Eclipse. It does all Web Tools platform related configuration for you at import time. It means all projects get configured as Faceted Projects with required facets after import is finished, so you can use it as regular Web Tools project and start Web Development right away without spending time to manual configuration.

Proposal document is located http://www.eclipse.org/proposals/technology.m2e.m2e-wtp/.

JBoss Tools Community announcement https://community.jboss.org/en/tools/blog/2012/03/28/moving-m2e-wtp-project-to-eclipse

Enjoy!

Tuesday, November 22, 2011

How to Make Most Accessible Examples in The World

This video is done by Max Rydahl Andersen

Making Examples Accessible from Max Rydahl Andersen on Vimeo.

Slides as used at JUDCon 2011 for evening lightning talk. Audio was recorded later for the publishing as video.

In this video you will learn about the best way to provide examples. It is based on analysis of JBoss Tools Examples component and you'll know:
  1. Why examples are the important part of any project
  2. What is the best way to provide build support for examples
  3. What is the most usable IDE's and Operation Systems
  4. Who is installing examples and what languages would be most popular
  5. What build + IDE + OS + Language combination for examples would be most popular

Tuesday, January 4, 2011

How to get rid of .blobstore during mirroring eclipse update site using p2.mirror ant task

Mirroring eclipse p2 repositories is fairly simple. It just requires to read an article here and after that it supposed to be simple, but after it finally works I noticed that format of p2 repo it creates is not the same as downloaded from eclipse. The difference is in the way artifacts packed with pack200 are stored. Whatever you do with p2.mirror parameters all pack200 packed artifacts are published in .blobstore instead of *.jar.pack.gz files.

After digging repos available on eclipse I found a solution to controls that. Magic is in format attribute of destination tag. Documentation says: "A URL to another repository from which to copy the repository name and other properties". It gave me an idea to find p2 repo on download.eclipse.org with jar.pack.gz files and check its properties in artifacts.xml. Soon I noticed a property that controls it

<property name="publishPackFilesAsSiblings" value="true/">

So if you want to get rid of .blobstore in mirrored p2 repo just create artifacts.xml file like



  
     <property name="publishPackFilesAsSiblings" value="true"/>
  

Then in destination tag format attribute use URL to folder that contains artifacts.xml file with content provided above and p2.mirror task will copy 'publishPackFilesAsSiblings' attribute to your local mirror. This will force mirroring task to store artifacts packed with pack200 as jar.pack.gz files.

Friday, September 10, 2010

How to Get Decent Eclipse Based XML Editor Without Downloading Whole Eclipse SDK and Web Tools Binaries

If you're not going to develop Java application, plug-in or debug Eclipse based applications there is no reason to download whole bunch of archives with all eclipse features you're never going to use. So to keep your XML Editor small and free from UI clattering follow this simple steps:
  • Download Eclipse Platform 3.6.X from http://www.eclipse.org, which is only 50M instead of 170M for Classic Eclipse SDK
  • Unpack it somewhere to your local file system (this folder is referenced as ${eclipse} below in this article)
  • Start it by executing ${eclipse}/eclipse or ${eclipse}/eclipse.exe which depends on your operation system
  • Select folder that is going to be used to keep your stuff like new projects, if you're going to create something
  • Open "Install" dialog using "Help->Install New Software..." in bar menu
  • Install "Web, XML, and Java EE Development->Eclipse XML Editors and Tools" form "Helios - http://download.eclipse.org/releases/helios/" update site
  • Wait while Eclipse is downloaded selected software
  • Restart Eclipse when downloading and installation are finished and Eclipse asks you what you want to do
You're done with installation and now have fully functional XML editor with the lots features like: templates, content assist and validation based on DTD or XML Schema.

Friday, April 16, 2010

Build XULRunner Eclipse p2 Repo with Tycho

Prerequisites

  • Maven 3.0.0.alpha7
  • Scala
  • Subversive command line client
  • Java SE 1.5+

Environment used to write this article

eskimo@desktop:~/Projects/jbt-xulrunner$ ~/Java/apache-maven-3.0-alpha-7/bin/mvn -v
Apache Maven 3.0-alpha-7 (r921173; 2010-03-09 14:31:07-0800)
Java version: 1.6.0_0
Java home: /usr/lib/jvm/java-6-openjdk/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux" version: "2.6.31-21-generic-pae" arch: "i386" Family: "unix"

It is very simple process because Tycho does all work for you. All you need is to follow simple steps below.

Create separate folder for XULRunner build and make it current

eskimo@desktop:~/Projects$ mkdir jbt-xulrunner
eskimo@desktop:~/Projects$ cd jbt-xulrunner

Checkout XULRunner component from JBoss Tools Subversion repository. You need to use modular_build branch. It is temporary branch that is going to be merged to trunk next week, but I think it will stay here for a while after merge is happened.

First root only should be checked out from branch to avoid pulling out whole gigantic repository.

eskimo@desktop:~/Projects/jbt-xulrunner$ svn co --depth=files https://anonsvn.jboss.org/repos/jbosstools/branches/modular_build .

Then the same should be done for xulrunner component

eskimo@desktop:~/Projects/jbt-xulrunner$ svn co https://anonsvn.jboss.org/repos/jbosstools/branches/modular_build/xulrunner

After steps above it gets us to the JBoss Tools repository structure but with the only component.

Next step is pom.xml files generation, because this branch contains only parent-pom.xml in root. Scala is used to do it.

eskimo@desktop:~/Projects/jbt-xulrunner$ scala genpom.scala
Generate Agg for ./xulrunner
Modules: 8 Aggregator: 4

Now working copy is ready to build XULRunner Eclipse Feature and generate p2-repo for it. Make sure you are using maven3.

eskimo@desktop:~/Projects/jbt-xulrunner$ mvn install

In the end it should look like

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] trunk ............................................. SUCCESS [0.639s]
[INFO] xulrunner.all ..................................... SUCCESS [0.034s]
[INFO] xulrunner.plugins ................................. SUCCESS [0.006s]
[INFO] org.mozilla.xulrunner.cocoa.macosx ................ SUCCESS [5.637s]
[INFO] org.mozilla.xulrunner.gtk.linux.x86 ............... SUCCESS [3.595s]
[INFO] org.mozilla.xpcom ................................. SUCCESS [0.455s]
[INFO] org.mozilla.xulrunner.win32.win32.x86 ............. SUCCESS [3.238s]
[INFO] org.mozilla.xulrunner.gtk.linux.x86_64 ............ SUCCESS [4.083s]
[INFO] org.mozilla.xulrunner.carbon.macosx ............... SUCCESS [3.721s]
[INFO] site.all .......................................... SUCCESS [0.203s]
[INFO] org.mozilla.xulrunner.feature ..................... SUCCESS [0.563s]
[INFO] org.mozilla.xpcom.feature ......................... SUCCESS [0.571s]
[INFO] org.mozilla.xulrunner.site ........................ SUCCESS [4.045s]
[INFO] xulrunner.features ................................ SUCCESS [0.024s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:03.643s
[INFO] Finished at: Fri Apr 16 10:18:01 PDT 2010
[INFO] Final Memory: 89M/195M
[INFO] ------------------------------------------------------------------------

After that XULRunner Feature can be installed using p2repo from

xulrunner/site/org.mozilla.xulrunner.site/target/site

It should look in Eclipse Update dialog like on images below

Tuesday, April 13, 2010

Get Things Done with Tycho

Tycho is real Magic Wand for build engineers who supports Eclipse based projects. It just gets things done in minutes instead of weeks no matter what is size of your project. it just let it be built/tested in any way you want it:
- build and test everything at once
- build only what you needed piece by piece
It also lets any member of your team do the same and verify they local changes before commit them in source version control repository. It saves build server processor time and make continuous integration easier.

In reference to: tycho: Home (view on Google Sidewiki)

Remote Debugging for Eclipse Test Plugin Running by Tycho

When I report an issue in bug tracking system about a nightly build's JUnit test error I usually get simple answer that it is supposed to be working because it is working on developers workstation. After that routine conversation starts and it turns out that tests were running from development environment under Eclipse. Here I usually have to explain again and again that's not the same running tests from development environment and in build.

The right way to make yourself sure your tests will work in most cases without errors in nightly build is to start tests the same way as nightly build does. It was not easy for JBoss Tools tests until we created experimental branch and switched to Maven Tycho project. That means it is fairly easy to run tests now. Basically you need to change current directory and execute maven install goal. If it runs in development environment and in maven your tests are good and in most cases it should be fine in nightly build. Problems begin if it runs in development environment but it doesn't in maven. In this scenario you need to debug tests running in Tycho somehow and fix it. Fortunately it can be done using Java remote debugging support.

First of all you need to be sure you have built your sources you're going to debug and there is no differences between .java and .class files. If you're going find problem from previous build just get right tagged version and build it before debugging session.

Then open pom.xml for your Eclipse Test Plug-in and add Java VM arguments like it shown below (actual port numbers, server names and other parameters may be different, it depends from your environment)




   org.sonatype.tycho
      maven-osgi-test-plugin
      ${tycho-version}
      
      -Xdebug -Xrunjdwp:transport=dt_socket,address=8001,server=y,suspend=y
      
   


This snipped configured for remote debugging in OpenJDK 6, if your is different you might need to read [1] and configure it right for your java version.

Configure java projects with sources you're going to debug in Eclipse and create Remote Java Application configuration in Eclipse Debug Configuration dialog. Fill 'host' and 'port' fields with the same values from pom.xml argLine element. Press Apply button to save your changes and start your test plug-in from terminal like

$mvn install

It will go through build process and finally you ll see something like

[INFO] Expected eclipse log file: /home/eskimo/Projects/jbt-modular/jst/tests/org.jboss.tools.jst.web.kb.test/target/work/data/.metadata/.log
[INFO] Command line:
/bin/sh -c cd /home/eskimo/Projects/jbt-modular/jst/tests/org.jboss.tools.jst.web.kb.test && /usr/lib/jvm/java-6-openjdk/jre/bin/java -Dosgi.noShutdown=false -Dosgi.os=linux -Dosgi.ws=gtk -Dosgi.arch=x86 -agentlib:jdwp=transport=dt_socket,address=8001,server=y,suspend=y -jar /home/eskimo/.m2/repository/p2/osgi/bundle/org.eclipse.equinox.launcher/1.0.201.R35x_v20090715/org.eclipse.equinox.launcher-1.0.201.R35x_v20090715.jar -data /home/eskimo/Projects/jbt-modular/jst/tests/org.jboss.tools.jst.web.kb.test/target/work/data -dev file:/home/eskimo/Projects/jbt-modular/jst/tests/org.jboss.tools.jst.web.kb.test/target/dev.properties -install /home/eskimo/Projects/jbt-modular/jst/tests/org.jboss.tools.jst.web.kb.test/target/work -configuration /home/eskimo/Projects/jbt-modular/jst/tests/org.jboss.tools.jst.web.kb.test/target/work/configuration -application org.codehaus.tycho.surefire.osgibooter.uitest -testproperties /home/eskimo/Projects/jbt-modular/jst/tests/org.jboss.tools.jst.web.kb.test/target/surefire.properties
Listening for transport dt_socket at address: 8001

At this point build is waiting for you to attach remote debugger to the process because of using

suspend=y

in argLine element of your pom.xml file. So you need to return to eclipse and hit 'Debug' button in dialog opened before.

Build will continue at this point and stop on your break points so you can find out what is wrong with tests during nightly build.

[1] Java Platform Debugger Architecture - http://java.sun.com/javase/technologies/core/toolsapis/jpda/#Invocation

Thursday, April 1, 2010

Run Eclipse UI Test Plug-in without Eclipse Workbench Window Bothering You

In Test Driven Development it happens you need to run Eclipse UI Tests and keep working at the same time. You can start tests but then you'll get Eclipse Workbench window annoying you especially if you have several JUnit Test Suites to run. Eclipse Workbench Window will pop up and grab input focus for each new suite and that's really annoying. After fiddling with my linux I found several ways to solve this issue:
  1. Do not run tests at all, which is not acceptable for TDD;
  2. Run only Eclipse core tests without workbench window, which is not enough to make tests results reliable;
  3. Create new display and force test session to use it.
Firs option isn't reasonable at all. Second is good enough for non UI applications, but has no value for opposite ones. Third is not for none UI applications, but is the best for UI ones. Fortunately, it is amazingly easy to create new display and redirect your tests execution to it. You have couple options to consider for creating new display :
  1. start vncserver
  2. create virtual buffer using Xvfb
After you have created new display just pass display number as local environment variable in your command line like DISPLAY=:N ${your-command-line-here} and you'll never see your eclipse workbench window :) But if you need to follow tests for a while or just check what is going on from time to time you can use vncviewer or xwud for first or second option accordingly.

Monday, April 13, 2009

Web Tools 3.0.4 Installation Through Update Site Fails With Error

I bumped in this problem several times and newer had time to find a way to fix it. Every time I try to install WTP I get this error Today I finally got through it :) The solution is described here and it is in removing and adding back update site which is used during installation. So did I. I added WTP Update Site and tired to install WTP Features from it. It failed. I removed WTP Update Site and added it back, then tried it again and it finally went without errors. Looks like it might depend on mirror selected for installation.