Time of Update: 2018-07-19
1.在程式中匯入jar:log4j-1.2.15.jar 2.建立檔案log4j.properties放置在根目錄,並增加程式碼:log4j.rootLogger=INFO,CONSOLE,DayRollingFile
Time of Update: 2018-07-19
今天把項目拷貝到另一台電腦的Eclipse時,項目出現一個紅色驚嘆號,一般這是jre環境錯誤,於是在右鍵項目->Build Path配置本機上已存在的jre1.7,然後部署項目的時候開始報錯project facet java 1.8 is not supported,意思就是之前的項目中配置的project facets模板中使用的是jdk1.8,但是現在本機上卻只有1.7,所以你要把project facets中java的版本改為1.7就可以了。參考圖如下:
Time of Update: 2018-07-19
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%><html><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script
Time of Update: 2018-07-19
用tomcat6啟動時,出現下面的錯誤java.lang.NoClassDefFoundError: Lcom/opensymphony/xwork2/util/logging/Logger; Caused by: java.lang.ClassNotFoundException: com.opensymphony.xwork2.util.logging.Logger 原因是struts2的包和xwork的包的版本不同我用的是xwork-2.0.4.jar
Time of Update: 2018-07-19
習題1、 每個學生都有對應的歸屬地,學生Student,地址String類型 學生屬性:姓名和年齡 註:姓名和年齡相同的是為同一個學生,保證學生的唯一性 import java.util.*;class MapDemo {public static void main(String[] args) {HashMap<Student,String> hm=new
Time of Update: 2018-07-19
問題: You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list. Input: (2 -> 4 -> 3) + (5 -&
Time of Update: 2018-07-19
Java語言將分行符號\r\n寫進檔案時注意事項 2012-03-15 00:39:50| 分類: Java語言|舉報|字型大小 訂閱 1、將String寫入到檔案時,分行符號有一些會被過濾掉,沒有任何效果。 解決辦法:
Time of Update: 2018-07-19
有序否 允許元素重複否 Collection 否 是 List 是 是 Set AbstractSet 否 否 HashSet
Time of Update: 2018-07-19
樣本中需要用到兩個包:mail.jar和activation.jar,其下載地址為:http://java.sun.com/products/javamail/downloads/index.htmlhttp://java.sun.com/javase/technologies/desktop/javabeans/jaf/downloads/index.html
Time of Update: 2018-07-19
<div title="提示">移到這裡</div> <p title=""></p>等等 title屬性就是滑鼠移到相應內容上出現的提示資訊,以下有個樣式很漂亮的滑鼠提示。 ---------------------------------------------------------------------------------------
Time of Update: 2018-07-19
public class ReflectUtil {public static Class reflectClass(String className){try {return Class.forName(className);} catch (ClassNotFoundException e) {e.printStackTrace();}return null;}public static Object getClassInstance(Class clazz,
Time of Update: 2018-07-19
其實很簡單,方法如下: 每一步:進入某個https://www.xxx.com開頭的網站,把要匯入的認證下載過來, 在該網頁上右鍵 >> 屬性 >> 點擊"認證" >> 再點擊上面的"詳細資料"切換欄 >> 再點擊右下角那個"複製到檔案"的按鈕 就會彈出一個認證匯出的嚮導對話方塊,按提示一步一步完成就行了。
Time of Update: 2018-07-19
private void removeTempFiles(String... fileNames) {for (String fileName : fileNames) {try {new File(fileName).delete();} catch (Exception e) {}}} 其中, String... fileNames 代表什麼意思。 類型後面三個點(String...),是從Java
Time of Update: 2018-07-19
有關tomcat 6.0如何配置https服務的文章可以參考:http://blog.csdn.net/zhou_zion/article/details/6759171 以下主要講解如何使用https發起post請求: 參考文檔:梁棟前輩的《Java加密與解密的藝術》 import java.io.BufferedReader;import java.io.FileInputStream;import java.io.IOException;import
Time of Update: 2018-07-19
按照指定的列數和行數排列矩陣,代碼如下: import java.util.ArrayList; import java.util.List; /** * 排列指定大小的矩陣 * @author linyiteng1220 * */
Time of Update: 2018-07-19
How do I clear the Java cache? This article applies to: Platform(s):Windows 7, Vista, Windows XP, Windows 2000, Windows 2003 Java version(s):6.0, 7.0 Clearing the Java Plug-in cache forces the browser to load the latest versions
Time of Update: 2018-07-19
/* *解決了含有空格目錄下的錯誤 Runtime.getRuntime().exec("cmd /c" + "D:/1.txt"); /* public static void openSystemExeFile() { String strurl ="D:\t.txt"; File crtfle = new File(strurl); if (crtfle != null
Time of Update: 2018-07-19
java應用程式中處理設定檔和圖片路徑在打包後路徑不對的問題 1、建立一個類來管理這些配置的路徑,這個類最好和設定檔及圖片放在一個包中,在引用時:ManagerVariable .LOAD就擷取到了,此時無論是jar包還是exe包都不會出現檔案路徑錯誤了 package com.property;
Time of Update: 2018-07-19
package com.example.test;import java.util.ArrayList;import java.util.Arrays;import java.util.HashMap;import java.util.HashSet;import java.util.List;import java.util.Map;import java.util.Set;public class ConvertorTest {/** * @param args */public
Time of Update: 2018-07-19
某些應用情境下需要對圖片加上浮水印防止盜用,例如微博使用者圖片。Java中實現添加浮水印需要用到BufferedImage、Graphics2D 和ImageIO類。 1. 添加文字浮水印 import java.awt.AlphaComposite;import java.awt.Color;import java.awt.Font;import java.awt.Graphics2D;import java.awt.Image;import