Monday, March 26, 2012

How to obtain Xalan and Xerces's version numbers from their jars?

Both Xerces and Xalan has a utility class that reports its version number:

java -cp ./xerces.jar org.apache.xerces.impl.Version
java -cp ./xalan.jar org.apache.xalan.Version

Thursday, November 24, 2011

How to fix GWT 2.3.0's No source code is available for type ; did you forget to inherit a required module?

To fix the following error (or similar errors) when doing a mvn clean compile on a GWT 2.3.0 app:

[ERROR] Errors in 'jar:file:/C:/Documents%20and%20Settings/myfolder/.m2/repository/com/google/gwt/gwt-user/2.3.0/gwt-user-2.3.0.jar!/com/google/gwt/editor/client/EditorDriver.java'
[ERROR] Line 97: No source code is available for type javax.validation.ConstraintViolation; did you forget to inherit a required module?


Ensure that you have the following validation-api jar and validation-api-sources jar in your pom.xml file (OUTSIDE of the gwt-maven-plugin dependencies in your pom.xml):


< dependency >
< groupId >javax.validation< /groupId >
< artifactId >validation-api< /artifactId >
< version >1.0.0.GA< /version >
< scope >provided< /scope >
< /dependency >
< dependency >
< groupId >javax.validation< /groupId >
< artifactId >validation-api< /artifactId >
< version >1.0.0.GA< /version >
< classifier >sources< /classifier >
< scope >provided< /scope >
< /dependency >

Tuesday, September 13, 2011

Adding 'cmd.exe' onto the Windows context menu

Manually add the context menu

In explorer, open Tools, Folder Options.
Select the File Types tab.
For Windows XP: Go to NONE / Folder.
For Windows 2000: Press n to scroll to the N/A section.
For Windows NT/98/95: Press f to scroll to the Folders section.
Select the entry labeled Folder
For Windows 2000/XP: Press Advanced button.
For Windows NT/98/95: Press Edit button.
Select New
In the action block type "Command Prompt" without the quotes.
In the app block type "cmd.exe" without the quotes.
Save and exit Folder Options.
Now right click on Start, you should have a new drop down option. Open explorer and right click on a folder, select Command Prompt and a command window opens in that folder.

Wednesday, July 21, 2010

Setting tomcat in debug mode

To set Tomcat in debug mode:
1. Run {catalina_home}/bin/tomcat6w.exe
2. In Java tab, add the following lines to Java options:

-Xdebug
-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y


Thats it!

Thursday, May 20, 2010

m2eclipse (Maven 2 Eclipse Plugin) does not resolve project dependencies in Eclipse Ganymede/Eclipse Gallileo workspaces

This has bitten me too many times in the arse that I have finally decided to write myself a wiki on how to resolve this issue.

Reproducable on
---------------
Eclipse 3.4 Ganymede
Eclipse 3.5 Gallileo


Issue
------
Maven does not resolve all the dependencies and add the jar files in the workspace.


How to Resolve
----------------
1. Ensure that the following tags is in your .classpath file in your project (ensure that you have your JRE classpathenry above your maven classpathentry - exactly like the following):
< classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/ >
< classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/ >

2. Right click on your Project and navigate to Build Path -> COnfigure Build Path
3. In the 'Libraries' tab, click on 'Add Library' and click on 'Maven Managed Dependencies'
4. Click on the 'Maven Project Settings' link on the next window and ensure that the 'Resolve Dependencies from Workspace projects' is enabled.
5. Then, click on Windows -> Preferences -> Maven
6. Ensure that the 'Support multuple Maven modules mapped to a singe Eclipse workspace project' is enabled.
7. In that Maven dialog box, also ensure that 'install' is written in the 'Goals to run on project import:' textbox.
8. Now, right click on your Project and navigate to Maven
9. Ensure that the following are visible:
Disable Workspace Resolution
Disable Nested Modules
Disable Dependency Management
(The above three options mean that they are currently enabled. If, for example, it says 'Enable Nested Modules' rather than 'Disable Nested Modules', click on it to enable it.
10. Clean your project and build it.
11. Walla! You should see all your dependency jar files in the Maven Dependencies folder on your workspace. You can right click on your project -> Maven -> Update dependencies just to be sure too.

Friday, May 14, 2010

Checking security settings for each Windows user

To check the security settings for all your Windows users, go to:

gpedit.msc > "Local Computer Policy" > "Computer Configuration" > "Windows Settings" > "Security Settings" > "Local Policies" > "User Rights Assignment" >

Friday, January 29, 2010

Embedded jetty version problems in Eclipse

Issue:

In my project, I was getting maven to download two dependencies:
1.
< dependency >
< groupId >org.mortbay.jetty< /groupId >
< artifactId >jetty-embedded< /artifactId >
< version >6.1.9< /version >
< /dependency >


2. < dependency >
< groupId >org.openqa.selenium.client-drivers< /groupId >
< artifactId >selenium-java-client-driver< /artifactId >
< version >0.9.2< /version >
< /dependency >


Looking at the dependency tree for the selenium codebase, I found that the org.mortbay.jetty version number used in Selenium 0.9.2 was 5.1.0. Hence, Eclipse defaults to using Jetty API 5.1.0 for rather than 6.1.9 - causing my code (which needs Jetty 6.* to be marked as an error in Eclipse).


How to Resolve It?
-------------------------
Use Selenium 1.0.1:
< dependency >
< groupId >org.seleniumhq.selenium.client-drivers< /groupId >
< artifactId >selenium-java-client-driver< /artifactId >
< version >1.0.1< /version >
< /dependency >

This Selenium version uses Jetty 6.1.6. Hence, your project code (that needs Jetty 6.*) will be resolved correctly by Eclipse.