程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> JAVA編程 >> 關於JAVA >> 配置J2EE(v1.4.02)和Cloudscape(10.0)

配置J2EE(v1.4.02)和Cloudscape(10.0)

編輯:關於JAVA

 前天只是下載下來並沒有配置,今天配置下

  

  首先我們來配置J2EE

,去Sun公司下載J2SDK,和J2SDKEE,其實,我們可以下載那個集成版本的,地址我提取出來了

  

  這個版本集成了它們兩個,其中的J2SDK在安裝後的J2EE_SDK文件夾(我定義的那個安裝目錄名字為J2EE_SDK)的jdk\目錄。

  

  配置J2EE的環境變量比較簡單,我們可以先來設置兩個變量,我設置的如下:

  J2EE_HOME: ...\J2EE_SDK

  J2DK_HOME:...\J2EE_SDK\jdk

  

  添加path為:%J2EE_HOME%\bin;:%J2DK_HOME%\bin;

  

  檢查CLASSPATH值,沒有則新建。先給默認值:“.“; value是:.; 然後添加%J2EE_HOME%\lib\J2EE.jar;

  

  在開始菜單中啟動J2EE,菜單項為start default server, 啟動成功後,向地址欄輸入: http://localhost:port/index.Html 其中的port是你安裝時設置的端口號,我設置的為8000, 因為如果有http服務器如IIS,它占用80,而如果有Tomcat,占用8080,按照慣例,就給他8000吧~

  

  如果出現J2EE畫面,說明配置成功。

  

  下面配置Cloudscape

  

  其實人家IBM說的很清楚了,下面我摘取一下原文(前天我從網上找的那篇文章說實話已經有點兒落伍了,另外,那個人也不怎麼會用環境變量 :-)

  

  Using sysinfo

  

  You can use Cloudscape’s sysinfo tool to check the versions of Cloudscape products. Once you have the bin directory in your PATH, you can run sysinfo by typing the following command in a command window:

  

  sysinfo

  

  The sysinfo script sets the appropriate environment variables, including class path, and executes the sysinfo program.

  

  Running ij

  

  You can use the ij tool to connect to a Cloudscape database. Once you have the bin directory in your PATH, you can execute the ij command by typing the following:

  

  ij

  

  The ij script sets up environment variables like class path and executes the ij program.

  

  To create a database with ij, type the following command:

  ij> connect ’jdbc:cloudscape:testdb;create=true’;

  

  This command creates the database called testdb in the current directory and populates the system tables. You can then execute any SQL statements from the ij command line. When you are ready to leave ij, type:

  

  ij> exit;

  

  See the IBM Cloudscape Tools and UtilitIEs Guide for more information on running ij.

  

  --------------------------------------------------------------------------------

  

  Manually setting environment variables and paths

  

  If you cannot run the scripts for the Cloudscape tools and utilitIEs, you must complete certain steps manually. The following topics show how to manually set your environment and run the tools manually.

  

  The installation program asked you to choose a base directory where the software was installed; we recommended that you name it Cloudscape_10. This document refers to that directory as the Cloudscape base directory.

  

  If you do not plan to use the scripts in the frameworks/embedded/bin directory and your Operating system supports it, create an environment variable called CLOUDSCAPE_INSTALL and set its value to the path of the Cloudscape base directory. For example, if you installed the product in c:\Cloudscape_10, set CLOUDSCAPE_INSTALL to c:\Cloudscape_10:

  

  set CLOUDSCAPE_INSTALL=c:\Cloudscape_10

  

  The JVM (compiler or interpreter) needs to know the path (Operating system instructions about location) of every class file needed by your application. The class path is a list of the class librarIEs needed by the JVM and other Java applications in order to run your program.

  

  There are two ways to set the class path. You can set the Operating system’s CLASSPATH environment variable permanently or temporarily. If you set the environment variable temporarily, you must set it each time you open a new command window. Alternatively, you can set the class path with the runtime option, which means specifying the class path at the time you start your Java application and the JVM.

  

  In most development environments, it works best to set the Operating system’s CLASSPATH environment variable temporarily. Cloudscape provides some scripts to help you set your class path this way; they are found in theframeworks/embedded/bin directory or the frameworks/NetworkServer/bin directory. Run a script every time you open a new command window.

  

  For example, you can set your class path as follows:

  

  set CLASSPATH=%CLOUDSCAPE_INSTALL%\lib\cs.jar; %CLOUDSCAPE_INSTALL%\lib\cstools.jar;%CLASSPATH%

  

  To manually run the sysinfo utility, type the following in a command window or shell:

  

  Java com.ihost.cs.tools.sysinfo

  

  To manually run the ij utility, type the following in a command window or shell:

  

  Java com.ihost.cs.tools.ij

  ij> connect 'jdbc:cloudscape:testdb;create=true';

  

  When you are finished running the ij utility, type:

  ij> exit;

  

  看懂了嗎?

  其實很簡單,他說建議你加一個變量為Cloudscape_install, 值為安裝目錄,我建立的是CLOUDSCAPE_HOME, 然後說加入一個path,為%CLOUDSCAPE_HOME%\frameworks\embedded\bin這樣就可以執行裡面的bat文件了,就是sysinfo,ij。然後又加入到CLASSPATH中的如下值:lib中的那些jar文件,我就不詳細寫了。然後就可以運行這些工具了。

  

  先寫到這兒我先重啟一下。

  

  繼續...

  

  設置好了上面的Classpath,那麼我們就可以做下面的例子了;如果出現class找不到,有可能你的Classpath沒有設置好,你看一下cmd後中的set命令出來的結果,看與你設置的符合嗎? 如果不一樣,則你設置不對

  

  Output Cloudscape 10.0 version information

  

  C:\>java com.ihost.cs.tools.sysinfo------------------ Java Information ------------------Java Version:  1.4.2_04Java Vendor:   Sun Microsystems Inc.Java home:    C:\Program Files\Java\j2re1.4.2_04Java classpath: .;E:\Program Files\J2EE_SDK\lib\J2EE.jar;E:\Program Files\IBM\Cloudscape_10.0\lib\cs.jar;E:\Program Files\IBM\Cloudscape_10.0\lib\cstools.jar;E:\Program Files\IBM\Cloudscape_10.0\lib\csnet.jar;E:\Program Files\J2EE_SDK\jdk\lib\tools.jar;E:\Program Files\J2EE_SDK\jdk\lib\dt.jar;OS name:     Windows XPOS architecture: x86OS version:   5.1Java user name: tsuijyJava user home: D:\SettingsJava user dir:  C:\--------- Cloudscape Information --------[E:\Program Files\IBM\Cloudscape_10.0\lib\cs.jar] 10.0.1.0 beta - (29729)[E:\Program Files\IBM\Cloudscape_10.0\lib\cstools.jar] 10.0.1.0 beta - (29729)[E:\Program Files\IBM\Cloudscape_10.0\lib\csnet.jar] 10.0.1.0 beta - (29729)----------------------------------------------------------------------- Locale Information -----------------------------------------------------------------------

  

  C:\>Java com.ihost.cs.tools.ijij version 10.0 (c) 1997, 2004 IBM Corp.ij>

  

  Used without additional arguments, the -cp option tests for all Cloudscape libraries, outputting the librarIEs it can find as well as the ones it cannot, as shown below:

  

  C:\>java com.ihost.cs.tools.sysinfo -cpTesting for presence of all Cloudscape-related librarIEs; typically, only some are needed.For a list of possible arguments, type Java com.ihost.cs.tools.sysinfo -cp argsFOUND IN CLASS PATH:

    Cloudscape embedded engine library (cs.jar)

    Cloudscape Network Server library (csnet.jar)

    Cloudscape tools library (cstools.jar)

  

  NOT FOUND IN CLASS PATH:

    Cloudscape Client librarIEs (db2jcc.jar)  (com.ibm.db2.jcc.DB2Driver not found.)

  

  試一試:

  E:\Program Files\IBM\Cloudscape_10.0\demo\programs\simple>Java com.ihost.cs.tools.sysinfo -cp SimpleApp.classFOUND IN CLASS PATH:

    user-specifIEd class (SimpleApp)

  SUCCESS: All Cloudscape related classes found in class path.

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved