Java & eclipse-related content note

Source: Internet
Author: User

1. Eclipse startup Screen

A. Add the startup parameter. Example: eclipse.exe-showsplash C:/splash.bmp

More references: http://www.cnblogs.com/sharewind/archive/2007/03/11/671270.html

B. Modify the default image. Location: plugins/org. Eclipse. platform_3.3.2.r33x_v20071022 (the gray version number is used)

 

2. Tomcat virtual directory Configuration

Open the % Tomcat %/CONF/server. xml file, and add

<Context path="/myapp" docBase="D:/myapp" workDir="" debug="0" reloadable="true" crossContext="true" />

More references: http://blog.csdn.net/mmm123lmj/archive/2009/07/25/4378186.aspx

 

3. Struts database. properties configuration

# Database properties file# Oracle# driver=oracle.jdbc.driver.OracleDriver# url=jdbc:oracle:thin:@localhost:1521/dbname# username=oracle# password=oracle# DB2# driver=com.ibm.db2.jcc.DB2Driver# url=jdbc:db2://localhost:50000/dbname# username=db2admin# password=db2# MySQL# driver=org.gjt.mm.mysql.Driver# url=jdbc:mysql://localhost:3306/dbname# username=root# password=mysql

4. Disable cache on JSP pages

    response.setHeader("Pragma", "no-cache");    response.setHeader("Cache-Control", "no-cache");    response.setDateHeader("Expires", 0);

 

5. Disable caching on HTML pages

    <meta http-equiv="Pragma" content="no-cache" />    <meta http-equiv="Cache-Control" content="no-cache, must-revalidate" />    <meta http-equiv="Expires" content="0" />

 

 

6. type of request and response in was + struts2 + JSP

<%= request.getClass().getName() %>// org.apache.struts2.dispatcher.StrutsRequestWrapper<%= response.getClass().getName() %>// com.ibm.ws.webcontainer.srt.SRTServletResponse<%= request.getSession().getClass().getName() %>// com.ibm.ws.webcontainer.httpsession.HttpSessionFacade

 

7. Rad dynamic site does not support JDK 1.5 Solutions

The dynamic site established by IBM rad (rational application developer) 7.0. The supporting was does not support JDK 1.5 syntax when executing JSP.

(In fact the function is supported, just need to add the following red in the WEB-INF/ibm-web-bnd.xmi on the line)

<jspAttributes xmi:id="JSPAttribute_113" name="jdkSourceLevel" value="15"/>

 

The complete XML is as follows:

<?xml version="1.0" encoding="UTF-8"?><webappext:WebAppExtension xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:webappext="webappext.xmi" xmi:id="WebAppExtension_1270541893645" reloadInterval="3" reloadingEnabled="true" additionalClassPath="" fileServingEnabled="true" directoryBrowsingEnabled="false" serveServletsByClassnameEnabled="true">    <webApp href="WEB-INF/web.xml#WebApp_ID" mce_href="WEB-INF/web.xml#WebApp_ID"/>    <jspAttributes xmi:id="JSPAttribute_113" name="jdkSourceLevel" value="15"/></webappext:WebAppExtension>

 

 

8. Get the name of the current method in Java.

String sMethodName = Thread.currentThread().getStackTrace()[1].getMethodName();

 

9. Escape single quotes in the. properties file in Java

By default, single quotation marks (') in the. properties file will be escaped. To avoid escaping, add one
. Then it becomes /''.

 

10. WebLogic cache location

/Home/WebLogic/BEA/user_projects/domains/[project name]/servers/adminserver/tmp/_ wl_user/

 

11. Solution for prompting that Tomcat is not started in eclipse for 45 seconds

Find

%eclipse_space%/.metadata/.plugins/org.eclipse.wst.server.core/server.xml

Increase the value of Start-timeout.

 

 

12. Exclude vss svn file display in eclipse

Many methods mentioned on the Internet are used to exclude SVN files from the final files during compilation, rather than displaying them in Eclipse project files. The method to disable display is:

Eclipse menu: Project-> properties-> resource filtes. Click "add" to add excluse.
**/. SVN/** and **/vssver2.scc.

Or modify the project file.

//. Classpath file <classpathentry excluding = "**/. SVN/** | **/vssver2.scc/** "kind =" src "Path =" src "/> //. add the project file // to the projectdescription node. <natures> //... other content </natures> <filteredresources> <filter> <ID> 1295423967786 </ID> <Name> </Name> <type> 22 </type> <matcher> <ID> Org. eclipse. UI. IDE. multifilter </ID> <arguments> 1.0-name-matches-false-false-vssver2.scc </arguments> </matcher> </filter> <ID> 1295423967802 </ID> <Name> </Name> <type> 26 </type> <matcher> <ID> Org. eclipse. UI. IDE. multifilter </ID> <arguments> 1.0-name-matches-False -. SVN </arguments> </matcher> </filter> </filteredresources>

 

13. Eclipse deletes UDC (usage data collector)

The UDC of eclipse regularly uploads data to the server on the official website of eclipse to eliminate the worries of the province.

// Delete the org. eclipse. EPP. all jar files starting with usagedata // Delete Org. eclipse. EPP. all Folders starting with usagedata

Description of UDC: http://www.eclipse.org/org/usagedata/

 

14. Display spaces and tabs in eclipse)

Window -> Preferences -> General -> Editors -> Text Editors -> Show whitespace characters

15. arraylist case-insensitive sorting

List<String> alsDirectoryFiles = new ArrayList<String>();// ...if (alsDirectoryFiles != null && alsDirectoryFiles.size() > 0){    Comparator<String> sortComparator = String.CASE_INSENSITIVE_ORDER;    Collections.sort(alsDirectoryFiles, sortComparator);}

17. Efficient hashmap Traversal

import java.util.*;import java.util.Map.*;Map<String, Integer> mapper = new HashMap<String, Integer>();Iterator<Entry<String, Integer>> iterator = mapper.entrySet().iterator();while (iterator.hasNext()){Entry<String, Integer> entry = iterator.next();System.out.println("\tWord: " + entry.getKey() + "    --->    Count: " + entry.getValue());}

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.