DOS命令编译带有包名的JAVA类

1.当类没有包时dos下
javac qiuyu.java       //编译qiuyu类,生产class文件
java  qiuyu              //运行qiuyu类

 

2.当有包名情况下(package exercise;)

javac -d . qiuyu.java(注意-d空一格再打点再空一格)

java exercise.qiuyu

 

 

自定义classpath:

 

设置classpath,把引用到的包放进来,这样关联的类就不会缺失了

javac -encoding UTF-8 -classpath E:\kuaipan\study\jar\lucene.jar GraphDatabaseReader.java

 

 

Linux下面:

#!/bin/sh
JAVA_HOME="/usr/local/jdk7"
CLASSPATH="/home/lucene481/WEB-INF/classes"
HEAP="-Xms128m -Xmx128m"
for jar in /home/lucene481/WEB-INF/lib/*.jar
do
CLASSPATH=$CLASSPATH:$jar
done
echo "$CLASSPATH"
nohup "$JAVA_HOME"/bin/java -server -classpath $CLASSPATH ${HEAP} com.test.LoadData 

 

posted on 2013-05-27 17:54  lovebeauty  阅读(5394)  评论(2编辑  收藏  举报

导航