Eclipse error log August 17, 2005
Posted by Coolguy in Eclipse.add a comment
To view the Eclipse error log:
- Switch to the Plug-in Development perspective.
- In the Tasks view, in the bottom right pane, click the Error Log tab.
- The error log is displayed, showing the following for each error:
The status of the error (for example, error or warning)
A brief description of the error
Which plug-in the error derived from
The date and time that the error was thrown
If an error has a plus sign (+) at the start of it, this means that it is a complex problem, and there are a number of errors contributing to it. Click the plus sign to view the individual errors. - To see the details of a particular problem, double-click on the entry in the Tasks view.
- A separate window is displayed showing more details of the error
Servlets using Eclipse & Tomcat August 17, 2005
Posted by Coolguy in Eclipse.add a comment
Download
- Web Tools Platform (WTP) projectThe WTP project can be downloaded from http://download.eclipse.org/webtools/downloads/
- XDoclet 1.2.2XDoclet is available from http://xdoclet.sourceforge.net/
- Tomcat ServerTomcat is available from http://jakarta.apache.org/tomcat/
Steps:
- Open the J2EE Perspective. Window->Open Perspective->Other…->J2EE.
- Set up XDoclet preferences. Window->Preferences->J2EE Annotations->XDoclet. Make sure the “Enable XDoclet Builder” option is checked. Select your desired version level and navigate to your XDoclet home directory. Hit OK
- Add the Tomcat server. Window->Preferences->Server->Installed Runtimes. Hit the “Add” button.
- Select the appropriate Apache Tomcat level for your Tomcat server and hit the “Next” button. Fill in the appropriate Tomcat home directory. Hit the “Finish” button
- From the J2EE Project Explorer, right click on the “Dynamic Web Projects” group. Select New->Dynamic Web Project.
- Type the project name, “HelloWorld”. Make sure the “Add Module to EAR project” selection is unchecked. Tomcat does not support the use of EAR projects so we will only make a stand alone web application
- Expand the “Dynamic Web Projects” group to the HelloWorld web project, and then to the “Servlets” catgeory.
- Right click on “Servlets” and select New->Servlet
- Select the doDelete and doPut method checkboxes in addition to the defaults.
- Hit “Finish” to create the non annotated servlet.
- Double click on the HelloWorld class in the Project Explorer. Add the following code to the doGet method:
- PrintWriter out = new PrintWriter(System.out); out = response.getWriter(); out.println(“Hello world!”);out.close();
- Save and close the editor
- Select the “HelloWorld” web project. Right click and select Run As->Run on Server
- Choose to manually define a new Server. Select the Apache Tomcat version you have installed. Hit next
- Bingo !!
More:
http://www.eclipse.org/webtools/jst/components/j2ee/scenarios/ServletScenario.html
Cool Plugin’s August 17, 2005
Posted by Coolguy in Eclipse.add a comment
Coding Standards Plugin’s
- PMD: Coding standards plugin net.sourceforge.pmd.
- Sample rule set:
<?xml version=”1.0″?>
<ruleset
name=“myruleset”><description>
This ruleset is to be applied to all java projects
</description>
<!– selected rules from the ruleset-Basic Rules–>
<ruleref=“rulesets/basic.xml/EmptyCatchBlock”/>
<ruleref=“rulesets/basic.xml/EmptyIfStmt”/>
<ruleref=“rulesets/basic.xml/EmptyWhileStmt”/>
<ruleref=“rulesets/basic.xml/EmptyTryBlock”/>
<ruleref=“rulesets/basic.xml/EmptyFinallyBlock”/>
<ruleref=“rulesets/basic.xml/EmptySwitchStatements”/>
<ruleref=“rulesets/basic.xml/ReturnFromFinallyBlock”/>
<!– selected rules from the ruleset-Design Rules–>
<ruleref=“rulesets/design.xml/UseSingleton”/>
<ruleref=“rulesets/design.xml/SwitchStmtsShouldHaveDefault”/>
<ruleref=“rulesets/design.xml/AvoidDeeplyNestedIfStmts”/>
<ruleref=“rulesets/design.xml/DefaultLabelNotLastInSwitchStmt”/>
<ruleref=“rulesets/design.xml/MissingBreakInSwitch”/>
<ruleref=“rulesets/design.xml/UseSingleton”/>
<!– selected rules from the ruleset-Strict Exception Rules–>
<ruleref=“rulesets/strictexception.xml/AvoidCatchingThrowable”/>
<ruleref=“rulesets/strictexception.xml/SignatureDeclareThrowsException”/>
<ruleref=“rulesets/strictexception.xml/ExceptionTypeChecking”/>
<!– selected rules from the ruleset-Code Size Rules–>
<ruleref=“rulesets/codesize.xml/ExcessiveMethodLength”/>
<ruleref=“rulesets/codesize.xml/ExcessiveParameterList”/>
<ruleref=“rulesets/codesize.xml/ExcessiveClassLength”/>
<ruleref=“rulesets/codesize.xml/CyclomaticComplexity”/>
<ruleref=“rulesets/codesize.xml/ExcessivePublicCount”/>
<!– selected rules from the ruleset-Naming Rules–>
<ruleref=“rulesets/naming.xml/VariableNamingConventions”/>
<ruleref=“rulesets/naming.xml/MethodNamingConventions”/>
<ruleref=“rulesets/naming.xml/ClassNamingConventions”/>
<ruleref=“rulesets/naming.xml/AvoidDollarSigns”/>
<ruleref=“rulesets/naming.xml/SuspiciousConstantFieldName”/>
<!– All rules from the ruleset-Import Statement Rules–>
<ruleref=“rulesets/imports.xml/DuplicateImports”/>
<ruleref=“rulesets/imports.xml/DontImportJavaLang”/>
<ruleref=“rulesets/imports.xml/UnusedImports”/>
<ruleref=“rulesets/imports.xml/ImportFromSamePackage”/>
<!– All rules from the ruleset-Java Logging Rules–>
<ruleref=“rulesets/logging-java.xml/MoreThanOneLogger”/>
<ruleref=“rulesets/logging-java.xml/LoggerIsNotStaticFinal”/>
<ruleref=“rulesets/logging-java.xml/SystemPrintln”/>
<!– All rules from the ruleset-Braces Rules–>
<ruleref=“rulesets/braces.xml/IfStmtsMustUseBraces”/>
<ruleref=“rulesets/braces.xml/WhileLoopsMustUseBraces”/>
<ruleref=“rulesets/braces.xml/IfElseStmtsMustUseBraces”/>
<ruleref=“rulesets/braces.xml/ForLoopsMustUseBraces”/>
<!– All rules from the ruleset-Unused Code Rules–>
<ruleref=“rulesets/unusedcode.xml/UnusedPrivateField”/>
<ruleref=“rulesets/unusedcode.xml/UnusedLocalVariable”/>
<ruleref=“rulesets/unusedcode.xml/UnusedPrivateMethod”/>
<ruleref=“rulesets/unusedcode.xml/UnusedFormalParameter”/>
</ruleset>
Logging
- Log4E : Log4E is an Eclipse Plugin which helps you to use your logger easily in Java Projects.The Plugin Log4E is not bound to any special logging framework. Thus you might be able to adapt to your own logger by defining your own templates using the preferences. It has active support for Log4j, Commons Logging and JDK 1.4 logging. de.jayefem.log4e http://log4e.jayefem.de/index.php/Main_Page
Metrics
- Team-in-a box: http://www.teaminabox.co.uk/downloads/metrics/ Couldn’t get it to work.
- Code Analysis Plugin : http://cap.xore.de/ Advanced works well.
- net.sourceforge.metrics. Good enough for LOC etc. Works well.http://metrics.sourceforge.net/
Tips August 17, 2005
Posted by Coolguy in Eclipse.add a comment
Increasing memory allocation for Eclipse
- On Windows you can create a link to the eclipse.exe and in the Properties
of the link set the Target property as following: C:\Eclipse\eclipse.exe -vmargs -Xms64M -Xmx512M