顯示具有 JAVATOOL 標籤的文章。 顯示所有文章
顯示具有 JAVATOOL 標籤的文章。 顯示所有文章

2012年11月12日 星期一

Eclipse problem: import ClassName cannot be resolved.

1. Problem:
  When I write a java web project a long times, and use the subversion case,
  It appear the import ClassName cannot be resolved. problem

2. Solution:
    I don't know the real reason. But I solve it by
    choose the project item of menu -> Clean function


Reference:
Many other solution
May be the reason

2010年7月21日 星期三

Eclipse

匯出與匯入一個專案:
1. 匯出: Export -> Gerneral->ArchieveFile -> zip
2. 匯入: Import -> Existing projects into workspace -> select archieve file

PS. Sometimes you need to set the build path:
project -> java build path -> libaray

2010年7月19日 星期一

Script for wms-glite and ant

Hi guys:
I will teach u how to compiler the LCG-WMS-GLITE job,

1. you can enter gap31Sub1ShellRunRequire dir


2. edit net/asgc/gap/core/lsa/lqs/LCG2.java file
> vim net/asgc/gap/core/lsa/lqs/LCG2.java

3. setting the enviroment variable
> export PATH=$PATH:/home/Andy/apache-ant-1.7.1/bin

4. build the project
> ant fw_core.clean
> ant fw_core.build

5. put the jar file to gap-LCG-GLITE project (you can copy the old jar to temportay)
> cp /home/Andy/tmp/sour/gap31Sub1ShellRunRequire/fw_core/dist/gap-lsa-3.1-0.jar /opt/gap-LCG-GLITE/dist/gap-lsa-3.1-0.jar

6. start the gap-lsa
>/etc/init.d/lsaservice-lcg-glite restart

Build a java to class

1. It need many lib, but we use simple to write

cp.sh
{{{
#!/bin/sh

CP=.

for path in $(find /opt/apache-tomcat-5.5.27/webapps/gcp/WEB-INF/lib/ -name *.jar);
do
#echo $path
CP="$CP:$path";
done

#echo $CP;
#CP="$CP:./tmp/code/datawarehouse/";
javac -classpath $CP GapUserInit.java

}}}

2. A comand that to list all data to as a classpath
{{{
[Andy@localhost lib]$ ls | awk '{home = "/home/Andy/Desktop/GRC/Data/TO_Alang_20110222/UniProt/API/uniprotjapi/src"; classpath = classpath ":" home "/" $1; print classpath; }' | less | tail -n 1
}}}

2010年7月14日 星期三

java sign

{{{
#!/bin/bash

JAR_DIR=/home/Andy/apache-tomcat-5.5.27/webapps/gcp/jsp/JWS/JarFiles
keyPath=/home/Andy/portal/script/key_bak

openssl pkcs12 -export -chain \
-inkey $keyPath/hostkey.pem \
-in $keyPath/hostcert.pem \
-out $keyPath/host.p12 \
-CApath /etc/grid-security/certificates/ \
-name "vt-004"

mkdir -p tmp

cp -r $JAR_DIR tmp
cd tmp

mkdir -p signed_jar
cp -r $JAR_DIR/* signed_jar

for jar in $(find JarFiles -name *.jar);
do
echo $jar
echo ${jar/JarFiles/signed_jar}
zip -d $jar META-INF/\*
jarsigner -keystore $keyPath/host.p12 -storetype PKCS12 -signedjar ${jar/JarFiles/signed_jar} $jar vt-004 < ../password
done

/bin/cp -rf signed_jar/* /opt/apache-tomcat-5.5.27/webapps/gcp/jsp/JWS/JarFiles

}}}

2010年7月2日 星期五

JAR

1. Sign a jar file
若目前目錄有個 bin/jstojava 要 sign, 則可用
{{{
jar cvf applet_InvokingAppletMethodsFromJavaScript.jar jstojava
}}}


參考:
http://www.java-samples.com/showtutorial.php?tutorialid=664

2010年6月30日 星期三

JUnit

說明:
使用 Eclipse Junit


範例:
{{{
package test;

import static org.junit.Assert.*;
import org.junit.Test;

import net.asgc.gap.portal.handler.AutoDock4Handler;


public class AutoDockHandlerTest{
AutoDock4Handler ad4 = new AutoDock4Handler();

@Test
public void testAddParam() {
ad4.addParam("targetSEPath", "aaaa");
}

@Test
public void testCheckParameter() {
ad4.addParam("targetSEPath", "aaaa");
ad4.addParam("ligandSEPath", "bbb");
ad4.addParam("dpfSEPath", "ccc");

assertTrue(ad4.checkParameter());
}
}
}}}

2010年6月20日 星期日

JAVA TEST Script

當你要測式一群 lib 時,
需要一個 script 檔, 幫你link, 因此可以很方便作 migration platform test

{{{{
#!/bin/sh
GAP_HOME=`pwd`/.gap
CP=./
ROOT=/opt/apache-tomcat-5.5.27/webapps/gcp/WEB-INF/lib/

# do the classpath
for path in $(find $ROOT -name *.jar)
do

CP="$CP:$path"

done

# add other lib
CP=$CP:/home/Andy/tmp/apache-tomcat-5.5.27/common/lib/jce-jdk13-131.jar

# because this program need
export GAP_HOME=$GAP_HOME

# run your java
$JAVA_HOME/bin/javac -classpath $CP VQSClientTestBean.java
$JAVA_HOME/bin/java -classpath $CP VQSClientTestBean



}}}

2010年6月19日 星期六

Ant

1. 說明:



2. 常用命令:
ant targetname<> in build.xml




3. 範例:
I. ant fw_app.build








4. 注意:
1. ant 會 build 整個 java 需要的檔案
2. 有時要會作 clear 動作

///////////////////
Ant 說明
////////////////////
使用 build.xml


/////////////////////////////////////////////
Ant tag
/////////////////////////////////////////////
1. (專案)
說明:
可以定義此 project 相關的設定值
屬性:
name: The ant project name
default: Default want to build target
basedir: You seting this project root path


2. (變數)
說明:
宣告 ant varaible, 在往後可以用 ${name} 取得變數
屬性:
name: Variable name
value: This varaible to value


3.
說明:
一個可以 build 或作其它操作指令的空間區
屬性:
name: 名稱
depends: 其它部份要先執行, 然後才能執行此 target 內容

4.
說明:
印出值在螢幕上

5.
屬性:
file: 要複製的來源檔
tofile: 目的地

6.
說明:
Ant support javac command
屬性:
srcdir: 要 compiler 資料夾
destdir: class 目地
includes: 預設是 compiler all, 但用 include 可以指定要 build file

7.
屬性:
verbose="true" : 是否印出刪除的檔案

8.
說明:
可包括許多檔案
屬性:
dir: set to the directory to file




//////////////////////////////////////////////////
Ant example
/////////////////////////////////////////////////
Simple build a project, compiler the src java to build directroy
to classs
{{{









Doing UKLights



Doing all






}}}


2.一個有 clean, 更多的 depends build, 從 build a file 到 build 更多 depends
{{{









Doing ExitControl





Doing AboutPopup



description="Builds AboutControl">
Doing AboutControl





description="Builds the main UKLights project">
Doing UKLights








Doing all













}}}