Setting CLASSPATH's on Windows & Linux

I am still new Java programming language, but I am coming along in learning the actually language. The one problem I keep running into is how to set a CLASSPATH on a windows machine and Linux machine. I have currently installed j2sdk1.4.2 on the windows machine and jdk1.5.0 on the linux machine. If any one has any suggestions on how to set these CLASSPATH's I would greatly appreicate it.

Before ammending classpath I recommend checking the
windows path variable. This variable is a list of
folders where windows looks for executables.
Path can be viewed by going to control panel ->
system _> advanced table -> environmental variables
and then selecting path and then edit.
Make sure �C:\Program Files\Java\J2SDK1.5.0\bin� (or
equivalent)is included.
Alternative you can enter �path = %path%; �C:\Program
Files\Java\J2SDK1.5.0\bin� into command prompt each
session.
This ensures that you can compile and execute java
programs from any directory. Ideally the java
installer should do it but I have found it does not.Indeed.
Similarly the classpath can be varied from either the
command prompt or it can be added to the
environmental variables.I'm one of those that recommends folks not set CLASSPATH using an environment variable.
IDEs like Eclipse and IntelliJ totally ignore it; so do containers like WebLogic and Tomcat.
One CLASSPATH does not fit all. Every project is unique. The best way to set it is with the -classpath option on both javac.exe and java.exe.
For compiling, you should learn Ant. It's a make tool built on Java and XML. That'll help with your compilation issues.
For running, you'll either run in a container, which has its own idea of CLASSPATH, or you can script the startup of a batch job using a Windows .cmd or *nix .sh.  Set the CLASSPATH in the script.
If altering it from the command prompt, in windows
use a �;� between paths variables and a �:� for unix
systems. Also include a �.� as one of the path
variable as it includes the pre-existing class path.
For example, when entered from the command prompt (in
windows), the following line will add �C:\
JavaPrograms� to the existing Classpath
Java �cp .;C:\JavaPrograms
Alternatively go into environmental variables as
described above and if a classpath variable does not
exist, create one and include �.� and your desired
directory.
Note: I prefer adding directories to the classpath
via the environment variables as it is more accepting
a folders with spaces in the name.Installing software in a folder with spaces in its name is asking for trouble. It's not highly recommended.
%

Similar Messages

  • Can we set classpath dynamically

    Is it possible to set Classpath from java code .. Before executing a Java class we can set classpath manually using set classpath option in windows .. But here i want to do that from java code .. not thru this dos command.. is there any java API's to do this ??

    Hey its possible ..
    File afile = new File (MyJarName);
    URL rl = new URL (afile.toURL().toString());
    URL [] ury = new URL [] {rl};
    URLClassLoader sysloader = (URLClassLoader) ClassLoader.getSystemClassLoader();
    Class sysclass = URLClassLoader.class;
    Method method = sysclass.getDeclaredMethod("addURL", new Class[]{rl.getClass()});
    method.setAccessible(true);
    method.invoke(sysloader, new Object[] {rl});
    String Classpath = System.getProperty("java.class.path");
    System.out.println("Before->"+Classpath);
    Classpath = Classpath + System.getProperty("path.separator") + rl.toString();
    System.setProperty("java.class.path", Classpath);
    Classpath = System.getProperty("java.class.path");
    System.out.println("After->"+Classpath);

  • Setting Classpath in linux

    Hi !! Can anyone help me in setting classpath in linux to run servlets/? I tried using this command..but didnt work
    export CLASSPATH="$CLASSPATH:/usr/share/tomcat5/server/lib/servlets-common.jar"
    Thanks
    Nive

    in ur autoexec.bat file write the following
    set PATH=C:\jdk1.5.0_04\bin;%PATH%
    set JAVA_HOME=C:\jdk1.5.0_04
    set
    CLASSPATH=.;C:\jakarta-tomcat-5.5.9\common\lib\servlet
    -api.jar;C:\jakarta-tomcat-5.5.9\common\lib\jsp-api.ja
    r;C:\Servlets+JSP;..;..\..;C:\jakarta-struts-1.2.4\lib
    \struts.jarThis response is meaningless. Principally because the OP specifically mentioned the use of LINUX. Not Windows.
    I've taken the advice of other forum users by avoiding a system level classpath variable. I define the classpath each time I compile and run. Working on Linux I tend to use command line argument files ( http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/javac.html#commandlineargfile ) which eliminates the need to redefine the classpath each time I compile or run my classes and apps. But others may do things differently.
    Here is a website you might want to check out which pertains to setting the classpath on Solaris and Linux.
    http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/classpath.html

  • Trouble Setting Classpath on Windows XP

    I'm having trouble setting up a classpath on Windows XP for SDK1.3.1_04.
    I've tried Control Panel\Advanced\Environment Variables\System Variables. There was a Path variable present, to which I've added:
    c:\jdk1.3.1_04\bin;
    There wasn't a Classpath variable present though. I've tried adding it myself in System Variables as follows:
    Variable name: Classpath
    Variable value: set classpath=.;
    But no joy. When I run "set" from the command prompt, there's no classpath present.
    I'd appreciate any help.
    Cheers.

    Hi,
    I am running on XP (unfortunately), but also win2000 and win98.
    Setting up the classpath is not a problem, although if you are logged in as root, then it does not always show correctly.
    Try logging back in as yourself and then checking the classpah through the set command.
    Altrnatively, if this is not the problem, actualy try a reboot. which should not be necessary.
    best
    kev

  • Setting Classpath on windows platform

    Hello
    I was trying to set classpath of "D:\documentum\config" in my environment variable , i was doing it through command
    prompt , the command i was implementing was
    set classpath=D:\documentum\config;
    but the when i was closing command prompt , the environment variable in windows named as ClassPath was not updating
    i have also tried this command
    set classpath=%classpath%;D:\documentum\config;
    this also having the same result , so how can i set this property through command prompt
    Regards

    You can permanently set command line environmental variables through the advanced settings in Windows. You have to hunt around for it a bit, it is somewhere behind opening the right click properties of "my computer" (or whatever it is called in your flavor of Windows) and then choosing advanced. An "environmental variables" tab should be present there.
    BUT! I would not advise you to set a classpath variable unless you fully realize that is only to make your development life a bit easier when working on the command prompt. When making your application ready for deployment the classpath must be managed without the variable. A script could work, or packaging everything up as an executable jar. When you start to work with an IDE like Eclipse or Netbeans you don't need that variable at all any more.

  • Set classpath in Window 95, 98, ME

    Hi,
    Would anybody please show me how to set the class path in windows 95, 98, ME.
    I used: set classpath=c:\ but it did not work
    Thanks

    hi,
    Instead of using 'classpath' try and use just 'path'.
    If JDK is installed in C: then the path would be
    "path=c:\jdk1.3\bin;%path%"
    Regards
    Deepa Datar

  • Setting classpath in windows ME

    how to set it?
    I have placed a file "test.java" in the directory c:\test
    i set the classpath in Dos prompt by:
    set classpath=c:\test;
    however, the following message appear:
    C:\>javac test.java
    error: cannot read: test.java
    1 error
    can anyone help me? is it the way to set classpath in Windows ME is different from other versions of Windows? That's urgent, Thanks!!

    setta le impostazioni in questo modo:
    Avvio --> Programmi --> Accessori --> Utilit� di Sistema --> Microsoft System Infomation.
    Selezionare la voce "Utilit�" di configurazione di sistema dal menu "Strumenti". Selezionare quindi "Ambiente", variabile PATH e premere il pulsante "Modifica";
    Da questa sezione puoi fare il SET DEL PATH E CLASSPATH.
    RESTART PC, E PROVA SE TUTTO FUNZIONA.
    PS. se non riesci a capire l'italiano, posso seguirti in lingua inglese. , fammi sapere anche via mail.

  • Setting classpath permanantly on linux

    Helloa folks;
    My serach through the archive didn't turn up any answer to this. I am trying to set the classpath variable permanantly on Linux (SuSe). I have been using "export JDK_HOME=YadaYada", but this doesn't live on between sessions and re-boots. How does one permamantly configure this environment variable for all users including root on a linux bo so that it lives on between sessions and re-boots?
    TIA, Will-

    Please, don't cross post! Check answer in
    http://forum.java.sun.com/thread.jsp?thread=185668&forum=31&message=594195

  • Setting classpath in Windows XP

    I have read numerous questions and replies pertaining to setting the classpath in Windows XP but have yet to find a clearcut answer. I have JDK 1.4 with the correct PATH set. Generally speaking, what do I type when setting up the CLASSPATH for windows XP? In addittion, what about jar files, libraries, and packages? Thanks

    CLASSPATH contents depend totally on what you establish as your Java environment.
    A classpath value tells Java to look "here" for the files that you create. (It knows where it's "own" files and jars are, we don't any longer have to tell it where to find them.)
    If no classpath variable is set. Java uses a default CLASSPATH of the current directory. Many people can run this way.
    If you set a classpath it cancels the default setting. Therefore, it's necessary to start it with a period, which represents the current directory. Use a semicolon to separate this and subsequent entries.
    Follow that with directory paths that point to directories that you want Java to search to find files and jars that you create or that applications need to use.
    If Java needs a file or jar and it can't find it in one of the classpath entries, it will complain with a "classpath not found" error.
    Here's my SET CLASSPATH statement:
    SET CLASSPATH=.;C:\NetRexx\lib\NetRexxC.jar;C:\j2sdk1.4.0_01lib\tools.jar;C:\mnrx;C:\NetRexx\NrxRedBk

  • Setting Classpath and Path on Windows ME

    Hi..How do I set up the classpath and path on windows ME. Do I use DOS or run the autoexec.bat from windows directly. I have jdk1.3.1 abd my classpath and path are:
    set classpath="C:\jdk1.3.1\bin"
    set PATH=C:\windows\xxxx\;C:\jdk1.3.1\bin
    I sometimes can't compile my programs from other directories other than jdk1.3.1\bin. Why? Is there a way I can compile my program just from the C:\ directory like:
    C:\javac myprogram.java
    C:\java myprogram
    Thanks.

    If you put . in the beginning of your classpath, java always searches the folder you are currently in.
    Now to set the classpath try clicking from the startmenu:
    settings/control panel/system. Then click advanced tab and then the Enviroment variables. I'm on win2000 but I think it should be the same on ME.
    Make sure it starts with .;C:\jdk1.3.1\bin;....
    I think installing jdk puts in the essentials, but if you have certain folders you store your classes in you can stick those in there as well.
    If you hava more questions about this, I suggest searching these forums on Keywords like : "set CLASSPATH PATH". Then you'll find a bunch of threads solving this problem.
    Sjur

  • Windows主机访问虚拟机linux中的oracle实例的安装方法

    在学习oracle时一般都会在windows中安装虚拟机,在虚拟机安装linux系统并[安装oracle.
    下面是自己的在windows中安装虚拟机并让windows主机能访问虚拟机中oracle实例的安装方法写的不好请大家多多包涵.
    一.准备安装所需要的软件:
    1.VMware虚拟机的下载和安装在我的博客中已经提到,这里就不再详细阐述。
    2.先推荐一个redhat的下载地址,RedHat Linux 5企业版:content.gougou.com/content,
    这个比较全面,但是也比较大(2.68G),如果自己有合适的linux安装版本,可以不使用这个。
    二.在VMware虚拟机为RedHat Linux创建新的虚拟机就不详述了
    三.在新建的虚拟机里安装RedHat Linux就不详述了
    四.在linux系统中安装oracle
    为了创建一个新的oracle用户输入和以下相似的命令:
    # /usr/sbin/useradd -g oinstall -G dba[,oper] oracle
    给oralce用户设置密码
    # passwd oracle
    修改内核参数编辑/etc/sysctl.conf文件
    kernel.shmall = 2097152
    kernel.shmmax = 2147483648
    kernel.shmmni = 4096
    kernel.sem = 250 32000 100 128
    fs.file-max = 65536
    net.ipv4.ip_local_port_range = 1024 65000
    net.core.rmem_default = 262144
    net.core.rmem_max = 262144
    net.core.wmem_default = 262144
    net.core.wmem_max = 262144
    当在/etc/sysctl.conf文件中指定这些内核参数后你要重启系统
    也可以执行以下命令让内核参数生效
    /sbin/sysctl -p
    给oracle用户设置shell限制
    为了提高数据库软件在linux系统中的性能你必须给oracle用户增加以下shell限制:
    shell limit item in limits.confg hard limit
    能打开文件的最大数量 nofile 65536
    单个用户可用的最大进程数 nproc 16384
    在/etc/security/limits.conf文件中增加以下限制:
    oracle soft nproc 2047
    oracle hard nproc 16384
    oracle soft nofile 1024
    oracle hard nofile 65536
    在/ect/pam.d/login文件如果下面显示的参数没有就增加到该文件中
    session required pam_limits.so
    根据oracle用户的默认shell,对默认的shell启动文件进行以下更改:
    对于Bourne, Bash, or Korn shell在/etc/profile文件中增加下面的代码
    if [ $USER = "oracle" ]; then
    if [ $SHELL = "/bin/ksh" ]; then
    ulimit -p 16384
    ulimit -n 65536
    else
    ulimit -u 16384 -n 65536
    fi
    fi
    对C shell(csh or tcsh)在/etc/csh.login文件中增加以下代码
    if ( $USER == "oracle" ) then
    limit maxproc 16384
    limit descriptors 65536
    endif
    创建oracle根目录可以输入以下相似的命令:
    # mkdir -p /mount_point/app/oracle_sw_owner
    # chown -R oracle:oinstall /mount_point/app/oracle_sw_owner
    # chmod -R 775 /mount_point/app/oracle_sw_owner
    如果oracle根目录的加载点是/u01并且oracle软件使用者用户为oracle那么oracle根目录的路径为:
    /u01/app/oracle
    [root@weblogic28 ~]# mkdir -p /u01/app/oracle
    [root@weblogic28 ~]# chown -R oracle:oinstall /u01/app/oracle
    [root@weblogic28 ~]# chmod -R 775 /u01/app/oracle
    当你配置oracle用户环境变量时设置ORACLE_BASE时就将oracle根目录的路径赋给ORACLE_BASE
    创建存储数据库文件和数据库恢复文件的目录
    创建存储数据库文件的目录的命令如下:
    # mkdir /mount_point/oradata
    # chown oracle:oinstall /mount_point/oradata
    # chmod 775 /mount_point/oradata
    将存放数据库文件的目录创建在oracle根目录下/u01/app/oracle/oradata
    [root@weblogic28 ~]# mkdir /u01/app/oracle/oradata
    [root@weblogic28 ~]# chown oracle:oinstall /u01/app/oracle/oradata
    [root@weblogic28 ~]# chmod 775 /u01/app/oracle/oradata
    创建oracle Home目录/u01/app/oracle/10.2.0/db
    [root@weblogic28 ~]# mkdir /u01/app/oracle/10.2.0/db
    [root@weblogic28 ~]# chown oracle:oinstall /u01/app/oracle/10.2.0/db
    [root@weblogic28 ~]# chmod 775 /u01/app/oracle/10.2.0/db
    创建存储数据库恢复文件的目录的命令如下:
    # mkdir /mount_point/flash_recovery_area
    # chown oracle:oinstall /mount_point/flash_recovery_area
    # chmod 775 /mount_point/flash_recovery_area
    将存放数据库恢复文件的目录创建在oracle根目录下/u01/app/oracle
    [root@weblogic28 ~]# mkdir /u01/app/oracle/flash_recovery_area
    [root@weblogic28 ~]# chown oracle:oinstall /u01/app/oracle/flash_recovery_area
    [root@weblogic28 ~]# chmod 775 /u01/app/oracle/flash_recovery_area
    创建一个/tmp目录
    [root@weblogic28 ~]# mkdir /u01/tmp
    [root@weblogic28 ~]# chmod a+wr /u01/tmp
    切换到oracle用户来设置环境变量
    [oracle@weblogic28 ~]$
    ls -a
    查看.bash_profile文件
    vi .bash_profile
    TEMP=/u01/tmp
    TMPDIR=/u01/tmp
    export TEMP TMPDIR
    export LD_ASSUME_KERNEL=2.6.9
    export ORACLE_BASE=/u01/app/oracle
    export ORACLE_HOME=/u01/app/oracle/10.2.0/db
    export ORACLE_SID=jycs
    export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
    export ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
    LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
    LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
    export LD_LIBRARY_PATH
    export PATH=$PATH:$ORACLE_HOME/bin
    CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
    CLASSPATH=$CLASSPATH:$ORACLE_HOME/network/jlib
    export CLASSPATH
    [oracle@weblogic28 tmp]$# umask
    0022
    umask命令将会显示22,022或0022
    [oracle@weblogic28 tmp]$# env | more
    REMOTEHOST=10.138.135.242
    HOSTNAME=weblogic28
    SHELL=/bin/bash
    TERM=ansi
    HISTSIZE=1000
    TMPDIR=/u01/tmp
    KDE_NO_IPV6=1
    QTDIR=/usr/lib64/qt-3.3
    QTINC=/usr/lib64/qt-3.3/include
    USER=root
    TEMP=/u01/tmp
    LS_COLORS=no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:bd=40;33;01:cd=40;33;0
    1:or=01;05;37;41:mi=01;05;37;41:ex=01;32:*.cmd=01;32:*.exe=01;32:*.com=01;32:*.b
    tm=01;32:*.bat=01;32:*.sh=01;32:*.csh=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:
    *.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*
    .bz=01;31:*.tz=01;31:*.rpm=01;31:*.cpio=01;31:*.jpg=01;35:*.gif=01;35:*.bmp=01;3
    5:*.xbm=01;35:*.xpm=01;35:*.png=01;35:*.tif=01;35:
    ORACLE_SID=jycs
    ORACLE_BASE=/u01/app/oracle
    KDEDIR=/usr
    MAIL=/var/spool/mail/root
    PATH=/usr/lib64/qt-3.3/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:
    /usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
    INPUTRC=/etc/inputrc
    上面显示了你所设置的环境变量
    也可以用下面的命令来查看环境变量
    [oracle@weblogic28 tmp]$ echo $ORACLE_HOME[$ORACLE_SID,$ORACLE_BASE]
    将数据库软件包拷贝到linux系统中
    然后解压文件
    $ gunzip filename.cpio.gz
    [oracle@weblogic28 tmp]$ gunzip 10201_database_linux_x86_64.cpio.gz
    执行上面的命令后会出现在 10201_database_linux_x86_64.cpio文件包
    再执行如下命令解压文件
    $ cpio -idmv < filename.cpio
    [oracle@weblogic28 tmp]$ cpio -idmv <10201_database_linux_x86_64.cpio
    database/stage/prereq/db/refhost_Custom.xml
    database/stage/prereq/db/refhost.xml
    database/stage/prereq/db/db_prereq.xml
    database/stage/prereq/db/dbprereq.jar
    database/stage/prereq/db
    database/stage/prereq/oui/knowledgesrc.xml
    database/stage/prereq/oui/rulemap.xml
    database/stage/prereq/oui/OraPrereqChecks.jar
    database/stage/prereq/oui
    database/stage/prereq/common/rulemap.xml
    database/stage/prereq/common
    会出现以上信息
    如果是远程安装可以使用VNC远程连接到linux服务器上来执行界面安装
    1、配置并开启vnc服务
    [oracle@localhost ~]$ vncserver
    You will require a password to access your desktops.
    Password: ---这里要求输入vnc客户端登录的密码并重复
    Verify:
    New 'localhost.localdomain:2 (oracle)' desktop is localhost.localdomain:2
    Creating default startup script. /home/oracle/.vnc/xstartup
    Starting applications specified in /home/oracle/.vnc/xstartup
    Log file is /home/oracle/.vnc/localhost.localdomain:2.log
    ----如上告诉你vnc终端已经创建好,用的是第二个终端
    2、在创建vnc服务的用户目录下会生成一个.vnc的隐藏目录
    [oracle@localhost ~]$ ls -a
    . .bash_profile Disk1 .gconfd .gstreamer-0.10 .metacity README.htm .viminfo
    .. .bashrc .eggcups .gnome .gtkrc-1.2-gnome2 .mozilla .redhat .vnc
    .bash_history .chewing .emacs .gnome2 .ICEauthority .nautilus .scim .Xauthority
    .bash_logout Desktop .gconf .gnome2_private .kde p8202632_10205_Linux-x86-64.zip .Trash .zshrc
    3、进入.vnc目录,找到xstartup可执行文件,用vi 编辑器打开
    [oracle@localhost ~]$ cd .vnc/
    [oracle@localhost .vnc]$ ls
    localhost.localdomain:2.log localhost.localdomain:2.pid passwd xstartup
    [oracle@localhost .vnc]$ vi xstartup
    #!/bin/sh
    # Uncomment the following two lines for normal desktop:
    # unset SESSION_MANAGER
    exec /etc/X11/xinit/xinitrc ---去掉前面的#号即可 --保存退出
    [ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
    [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
    xsetroot -solid grey
    vncconfig -iconic &
    xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
    twm &
    ~
    [ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
    "xstartup" 12L, 333C 已写入
    [oracle@localhost .vnc]$ vncserver
    New 'localhost.localdomain:3 (oracle)' desktop is localhost.localdomain:3
    Starting applications specified in /home/oracle/.vnc/xstartup
    Log file is /home/oracle/.vnc/localhost.localdomain:3.log
    4、清除刚才创建的vnc虚拟终端
    [oracle@localhost .vnc]$ vncserver -kill :1
    Can't find file /home/oracle/.vnc/localhost.localdomain:1.pid
    You'll have to kill the Xvnc process manually
    [oracle@localhost .vnc]$ vncserver -kill :2
    Killing Xvnc process ID 11889
    [oracle@localhost .vnc]$ vncserver -kill :3
    Killing Xvnc process ID 11945
    [oracle@localhost .vnc]$ vncserver -kill :4
    Can't find file /home/oracle/.vnc/localhost.localdomain:4.pid
    You'll have to kill the Xvnc process manually
    5、重新建立新的vnc虚拟终端
    [oracle@localhost .vnc]$ vncserver
    New 'localhost.localdomain:2 (oracle)' desktop is localhost.localdomain:2
    Starting applications specified in /home/oracle/.vnc/xstartup
    Log file is /home/oracle/.vnc/localhost.localdomain:2.log --该终端号为 :2
    6、在windows客户端用RealVNC软件中的Run VNC Viewer客户端连接。
    7、在Run VNC Viewer 只需输入linux服务器的地址和刚才生成的终端号:2
    格式:192.168.1.56:2
    8、输入刚才配置vnc服务的时候配的即可登录linux服务器图形界面。
    如果是本地安装的话执行下面的步骤
    用root用户登录
    [root@weblogic28 ~]#xhost + 让任何用户都是启用图形界面
    切换到oracle用户
    [root@weblogic28 ~]su - oracle
    [oracle@localhost ~]$ cd /database
    [oracle@weblogic28 database]$./runInstaller
    设置虚拟机的IP地址让主机可以访问虚拟机
    1、     NAT方式
    1.1     右键单击主机任务栏上的网络连接图标,选择打开网络连接页面
    1.2     启动”VMware Network Adapter VMnet8” 和 “VMware Network Adapter VMnet1”这两个连接
    1.3     右键单击“本地连接”,选择属性,打开”本地连接属性”对话框,选择”高级”标签,打开高级标签页面,选中选项”允许其它网络用户通过此计算机的internet连接来连接”,然后在”家庭网络连接”下拉列表中选择VMware Network Adapter VMnet8。
    1.4     在虚拟机上右键单击你要设置的虚拟机选“setting”(因为有的不止虚拟一台),打开”Hardware”标签页,单击”device”下的ethernet,此时在右边选中NAT:Used to share the host’s IP address. 然后点击确定。
    1.5     打开虚拟机上的Edit菜单,选择virtual network settings打开virtual network editor页面,先打开automatic bridging标签页,关闭automagic bridging,点击应用;再打开DHCP标签页,启动DHCP服务,然后点击应用;最后打开NAT标签页,启动NAT服务,然后点击应用;点击确定后退出
    1.9     启动虚拟机中的系统。
    1.10     设置虚拟机中的系统的IP地址为192.168.100.200,默认网关为192.168.100.1 (VMware Network Adapter VMnet8的IP地址),DNS服务器设置和主机中的DNS服务器一致。
    1.11     重新加载网络参数或者重新启动虚拟机中的系统。
    1.12设置静态IP地址.
    (1).命令行设置(该方式只是临时设置,系统重启后失效)
    [1].设置IP和掩码
    ifconfig 接口名(如eth0) IP地址 netmask 子网掩码
    [2].设置网关
    route add default gw 默认网关
    [3].设置DNS服务器地址
    echo "nameserver DNS服务器地址">/etc/resolv.conf
    实例:假设设置eth0的IP:192.168.1.100,DNS:192.168.1.12
    ifconfig eth0 192.168.100.200 netmask 255.255.255.0
    route add default gw 192.168.100.1
    echo "nameserver=192.168.1.12">/etc/resolv.conf
    (2).修改文件来实现配置网络(需要重启网络接口重启后IP不会改变)
    [1].修改IP地址,文件:/etc/sysconfig/network-scripts/ifcfg-接口名
    这里假设网络接口名为eth0.
    vi /etc/sysconfig/network-scripts/ifcfg-eth0
    DEVICE=eth0 (注:这里填的是网络接口名)
    BOOTPROTO=static
    ONBOOT=yes (注:是否随系统启动)
    IPADDR=192.168.100.200(注:这里填写的是IP地址)
    PREFIX=24 (注:这里填写的是掩码的长度)
    NETMASK=255.255.255.0
    GATEWAY=192.168.100.1( 注:这里写的是网关)就是VMware Network Adapter VMnet8的IP地址
    [2].修改DNS
    echo "nameserver DNS服务器地址">/etc/resolv.conf
    [3].重启网络接口(假设为eth0)
    ifup eth0(注:这里写的是接口名)
    关闭linux防火墙
    (1) 重启后永久性生效:
    开启:chkconfig iptables on
    关闭:chkconfig iptables off
    (2) 即时生效,重启后失效:
    开启:service iptables start
    关闭:service iptables stop
    linux下Oracle自动启动与停止
    1.修改Oracle系统配置文件/etc/oratab
    /etc/oratab 格式为: SID:ORACLE_HOME:AUTO
    把AUTO域设置为Y(大写),只有这样,oracle 自带的dbstart和dbshut才能够发挥作用。我的为:
    $ORACLE_SID:$ORACLE_HOME:Y
    这儿的ORACLE_SID和ORACLE_HOME是oracle用户下的环境变量,在不同的电脑上有不同的值.当你打开/etc/oratab的时候,修改一下就行了.
    2.编写服务脚本
    在/etc/rc.d/init.d目录下创建oracle文件作为启动脚本,内容如下:容如下:
    #!/bin/sh
    #chkconfig: 2345
    #description:oracle_orcl
    # /etc/rc.d/init.d/oracle_orcl
    # auto start database orcl instance
    #set oracle env
    export ORACLE_BASE=/u01/app/oracle
    export ORACLE_HOME=$ORACLE_BASE/oracle/product/10.2.0/db_1
    export PATH=$PATH:$ORACLE_HOME/bin
    export ORACLE_SID=orcl
    ORACLE_USER=oracle
    #start or stop script
    case $1 in
    start)
    su - "$ORACLE_USER"<<EOO
    lsnrctl start LISTENER
    sqlplus /nolog<<EOS
    connect /as sysdba
    startup
    EOS
    EOO
    stop)
    su - "$ORACLE_USER"<<EOO
    lsnrctl stop LISTENER
    sqlplus /nolog<<EOS
    connect /as sysdba
    shutdown immediate
    EOS
    EOO
    echo "Usage: $0 {start|stop}"
    esac
    在oracle用户下输入如上的内容,然后保存退出,由于是启动脚本,需要执行权限;执行命令chmod a+x oracle授予oracle执行权限.
    3.建立服务连接
    ln -s /etc/rc.d/init.d/oracle /etc/rc.d/rc2.d/S99oracle
    ln -s /etc/rc.d/init.d/oracle /etc/rc.d/rc3.d/S99oracle
    ln -s /etc/rc.d/init.d/oracle /etc/rc.d/rc5.d/S99oracle
    ln -s /etc/rc.d/init.d/oracle /etc/rc.d/rc0.d/K01oracle
    ln -s /etc/rc.d/init.d/oracle /etc/rc.d/rc6.d/K01oracle
    或可以通过执行以下命令来实现
    chkconfig --add oracle
    chkconfig命令运行成功后,在rc2.d,rc3.d,rc4.d,rc5.d下面建立了S99oracle 连接文件,可以在系统启动的时候,运行脚本启动数据库。在rc0.d、rc1.d和rc6.d目录下面建立了K99oracle文件,用于在系统关闭的时候自动运行脚本关闭数据库。可以使用 chkconfig --list oracle 命令查看服务配置,关于chkconfig更多的用法,可以通过man chkconfig查看
    4.测试
    启动,运行命令:./oracle_linuxdb start
    关闭,执行命令:./oracle_linuxdb stop
    可以用sqlplus user/passward@tnsname来测试启动和关闭数据库是否成功。现在重新启动linux主机,看数据库是否自动启动了.
    这样主机就能访问虚拟机中的oracle数据库了

    其实运用Oracle Virtual Box + OEL会使安装数据库变得更加简便。

  • Windows - Linux, jar-archive problem

    I?m programming a project in Eclipse on a WinXP-pc. This project includes some external jar-archives like the mysql-connector. Now I have to run this project on a redhat-linux pc in a shell. Can anybody tell me, where I have to place these jar-files so java and my project will find them?

    If I want to compile a file in my project (which is not much more than this single file atm) I have to use javac with the -cp option to specify the location of my external jar, doesn?t I? Yes. Both java and javac need to know the classpath.
    Let?s say the file I want to compile is called ApiTest.java. The file and the external jar mysql-connector.jar are placed in the same directory c:\workspace on my windows-machine. Am I right, that the instruction on a command line should look like: "javac -cp c:\workspace\mysql-connector.jar ApiTest.java" executed in c:\workspace?You should include the current directory in the classpath. (with "dot")
    javac -cp .;c:\workspace\mysql-connector.jar ApiTest.java
    I have the added the mysql-connector.jar to my classpath by using "set classpath=...". But when I try to compile my file, I get the error-message package com.mysql does not exist (com.mysql is the directory-structure in the mysql-connector.jar)... ;(I don't use a CLASSPATH variable. In any case its value is ignored when you set the classpath using -cp. Hence the need to specify the current directory as part of the classpath.
    Is there a com.mysql package? I ask because when I use the line "import com.mysql.*;", I get the same error. There is no such package to be found in the version of mysql-connector I am using: mysql-connector-java-5.0.5-bin.jar (512707 bytes).
    Putting a similarly named TestApi.java and the jar file into ~/JDC/workspace, here's what I see:
        pbrockway@linuxdeskd6off:~/JDC/workspace$ cat ApiTest.java\\    import java.sql.Connection;\\    import java.sql.DriverManager;
        public class ApiTest {\\        public static void main(String args[]) throws Exception {\\            Class.forName("com.mysql.jdbc.Driver").newInstance();\\            String urlStr = "jdbc:mysql://10.144.32.16/jdc?user=jdcuser&password=jdcpw";\\            Connection con = DriverManager.getConnection(urlStr);\\            System.out.println(con);\\        }\\    pbrockway@linuxdeskd6off:~/JDC/workspace$ javac -cp .:mysql-connector-java-5.0.5-bin.jar ApiTest.java\\    pbrockway@linuxdeskd6off:~/JDC/workspace$ java -cp .:mysql-connector-java-5.0.5-bin.jar ApiTest\\    com.mysql.jdbc.Connection@1113708\\    pbrockway@linuxdeskd6off:~/JDC/workspace$It compiles and runs OK. Things are exactly the same on Windows except that in both cases ; is used rather than : when specifying the classpath.

  • Help with setting classpath

    Hi All,
    I am new to servlets and JSP. I have a question regarding setting Classpath. My development directory structure is like this c:\..\desktop\java\project1\src\com\eg\web\e1.java. Servlet.jar file is in C:\Program Files\Apache Group\Tomcat 4.1\common\lib. I tried setting Classpath in windows 2000 using control panel=>System utility by this command
    SET CLASSPATH=.;c:\Program Files\Apache Group\Tomcat 4.1\common\lib\servlet.jar . I try to compile my program by going into the whole development directory structure C:\..\src\com\eg\web using javac e1.java. But I get the error "package javax.servlet does not exist". Can somebody help me resolve this?
    Thank You in advance
    Jaya

    Question 1: Are you using an IDE?
    [IDEs ignore the system classpath]
    Question 2: Did you try setting the classpath using the -cp option for javac, if you are not using an IDE?
    [you could also try to print the classpath on command line to check if it has taken effect]

  • Setting classpath in bat file

    Hi,
    I'm trying to call my java app from a bat file, normally I put all references to jar files hard coded in the bat file, but now I would like to loop over a lib directory and add all jars in that directory to the classpath:
    I tried the FOR loop of Windows batch like this:
    FOR /R .\lib %%G IN (*.jar) DO set CLASSPATH=%CLASSPATH%;%%G
    but the classpath only contains the last jar file of the directory, what is wrong with that line? A for loop on unix is no problem.
    THX

    Hi,
    I had teh same need, but neither
    FOR /R .\lib %%G IN (*.jar) DO set CLASSPATH=!CLASSPATH!;%%G
    works for me nor
    FOR /R .\lib %%G IN (*.jar) DO set CLASSPATH=%CLASSPATH%;%%G
    I have set the "ENABLEDELAYEDEXPANSION" also
    Regards

  • Clone dbtier error-- ERROR : Unable to set CLASSPATH

    i am setting a new clone of PROD server.i restored the backup from prod and now i ran
    perl adpreclone.pl dbTier
    Here is the error message-->
    perl adcfgclone.pl dbTier
    Enter the APPS password [APPS]:
    xxxx
    ERROR : Unable to set CLASSPATH
    /u02/lifedb/9.2.0/appsutil/clone/bin/../jlib/classes111.zip: is missing
    First Creating a new context file for the cloned system.
    The program is going to ask you for information about the new system:
    Error: can't find libjava.so.
    ERROR: context creation not completed successfully.
    Please check /tmp/adcfgclone_1376.err file for errors
    The err file does not have anything.
    I added /u02/lifedb/9.2.0/jdbc/lib to path and classpath. classpath is empty. I made cc,ar,ld,make,perl come in the path as well.
    Now how do i resolve the above err?
    Thanks

    If you want to migrate from Solaris to Linux, refer to:
    For the application tier:
    Note: 238276.1 - Migrating to Linux with Oracle Applications Release 11i
    https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=238276.1
    For the database tier:
    Note: 362205.1 - 10g Release 2 Export/Import Process for Oracle Applications Release 11i
    https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=362205.1
    Note: 331221.1 - 10g Export/Import Process for Oracle Applications Release 11i
    https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=331221.1
    Note: 230627.1 - Export/Import Process for Oracle Applications Release 11i Database Instances Using Oracle9i Enterprise Edition
    https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=230627.1

Maybe you are looking for

  • External USB Sound Card and 6-channel 5.1 SS speakers not working

    Hi. I purchased a few devices to expand my sound to 5.1 surround sound. However, I'm having trouble getting any results at all. Here's my situation. New 24-in Intel iMac Logitech G51 Surround Sound Speakers PPA International External Sound 6 Channel

  • Flex 4 beta tutorials great--but...

    I went through the tutorials at http://www.adobe.com/devnet/flex/articles/fcf_getting_started_coldfusion_flex_02.html and was very quickly able to get the sample (and some of my own cfc's) to work on my local pc. What I've been struggling with for da

  • Can u output video/audio from iPad?

    Will iPad play video to external source like tv?

  • G4 Titanium memory install but slot shows empty

    Just installed 2 512 dims into my G$ Titanium but it only recognizes one. The bottom slots shows 512 MB but the top shows the slot as empty. Reinstalled again but still the same. Tried my old 256 MB in the upper slot and still empty. What could I be

  • Photo viewers available to let you page through photos

    I'm working with an iMac (CRT) running OS 9.2.1...are there any photo viewers available to let you page through photos (not view one at a time.) I have downloaded "Multiple Picture Viewer" from TechRepublic but it's not really what I'm looking for.