- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个执行 sql 构建工作的 shell 脚本。
当从 unix 提示符手动调用它时,它正在执行并给出预期的结果。
但是当从 java 调用相同的方法时,它没有完全执行。
手动执行:
MODIFY_PATCH_CREATION.ksh 118765 CP_14052906_28112015134449_16
日志文件显示为:
Installing Patch for BATCH ID:118765 and PATCH NAME:CP_14052906_28112015134449_16
CP_14052906_28112015134449_16_RELEASE directory has been created
CP_14052906_28112015134449_16_INSTALL directory has been created
CP_14052906_28112015134449_16_ROLLBACK directory has been created
SQL and LOG directories have been created for INSTALL
INSTALL script is created
SQL and LOG directories have been created for ROLLBACK
ROLLBACK script is created
SQL files are created for INSTALL
SQL files are created for ROLLBACK
Patch installed Successfully..
但是如果我从 java 程序中执行相同的操作,如下所示:
java代码:
public class ShellTest{
public static void main(String a[]) throws Exception{
System.out.println("Hello kp");
Runtime.getRuntime().exec("MODIFY_PATCH_CREATION.ksh 118765 CP_14052906_28112015134449_16");
}
}
当作为 java ShellTest 执行时,日志仅在一定程度上出现
Installing Patch for BATCH ID:118765 and PATCH NAME:CP_14052906_28112015134449_16
CP_14052906_28112015134449_16_RELEASE directory has been created
CP_14052906_28112015134449_16_INSTALL directory has been created
CP_14052906_28112015134449_16_ROLLBACK directory has been created
SQL and LOG directories have been created for INSTALL
INSTALL script is created
SQL and LOG directories have been created for ROLLBACK
ROLLBACK script is created
SQL files are created for INSTALL
Shell脚本代码:
#!/bin/bash
BATCH_ID=$1
echo "BATCH_ID: $BATCH_ID"
PATCH_NAME=$2
echo "PATCH_NAME: $PATCH_NAME"
echo "Creating patch for batch id $BATCH_ID"
ARBOR_USR=`echo $K_CAT_USERNAME`
dateTime=`date '+%d%m%Y_%H%M%S'`
PATCH_DIR=$ARBORDIR/cw/CPF_GSA_Modify
RELEASE_DIR=$ARBORDIR/cw/CPF_GSA_Modify/$2_RELEASE
INSTALL_DIR=$ARBORDIR/cw/CPF_GSA_Modify/$2_RELEASE/$2_INSTALL/
ROLLBACK_DIR=$ARBORDIR/cw/CPF_GSA_Modify/$2_RELEASE/$2_ROLLBACK/
##Logfile creation for install
cd $PATCH_DIR
touch $2_PATCH_log_$dateTime.txt
log_file=$PATCH_DIR/$2_PATCH_log_$dateTime.txt
echo "Installing Patch for BATCH ID:$BATCH_ID and PATCH NAME:$PATCH_NAME" >>$log_file
mkdir $2_RELEASE
echo "$2_RELEASE directory has been created" >>$log_file
cd $2_RELEASE
mkdir $2_INSTALL
echo "$2_INSTALL directory has been created" >>$log_file
mkdir $2_ROLLBACK
echo "$2_ROLLBACK directory has been created" >>$log_file
cd $INSTALL_DIR
mkdir SQL
mkdir LOG
echo "SQL and LOG directories have been created for INSTALL" >>$log_file
cp $PATCH_DIR/vge_cpf_gsa_mod_db_install.ksh $2_install.ksh
sed -i "s/vge_cpf_gsa_mod_db/$2/g" $2_install.ksh
echo "INSTALL script is created" >>$log_file
#cd SQL
#touch sql_list.sql
cd $ROLLBACK_DIR
mkdir SQL
mkdir LOG
echo "SQL and LOG directories have been created for ROLLBACK" >>$log_file
cp $PATCH_DIR/vge_cpf_gsa_mod_db_rollback.ksh $2_rollback.ksh
sed -i "s/vge_cpf_gsa_mod_db/$2/g" $2_rollback.ksh
echo "ROLLBACK script is created" >>$log_file
#cd SQL
touch sql_list.sql
cd $INSTALL_DIR/SQL/
echo 'Going to Connect to database'
touch display.log
sqlplus $ARBOR_USR/`cat $ARBORDIR/.arborpw`@$ORACLE_SID << THEEND >>display.log
set define off;
set linesize 3000;
set head off;
set feedback off;
spool CW_NEW_MRC.sql;
SELECT 'UPDATE RATE_RC a SET INACTIVE_DATE= (SELECT DISTINCT active_date FROM CW_PC_RR b WHERE a.element_id=b.element_id AND a.component_id=b.component_id and rownum<2) WHERE ELEMENT_ID='||MEMBER_ID||' AND COMPONENT_ID= '||COMPONENT_ID||' AND INACTIVE_date IS NULL ;' STATEMENT FROM CW_OLD_MRC_RATES WHERE batch_id=$BATCH_ID;
select 'INSERT INTO "RATE_RC" ("RATE_CLASS", "ELEMENT_ID", "COMPONENT_ID", "EQUIP_TYPE_CODE", "EQUIP_CLASS_CODE", "CLASS_OF_SERVICE_CODE", "TYPE_ID_RC", "BILLING_FREQUENCY", "CURRENCY_CODE", "RATE", "JURISDICTION", "DISTANCE_INCREMENT", "UNITS_TYPE", "UNITS_LOWER_LIMIT", "UNITS_UPPER_LIMIT", "UNITS_RATE", "POP_LOWER_LIMIT", "POP_UPPER_LIMIT", "DISTANCE_RATE", "ADD_IMPLIED_DECIMALS", "DATE_CREATED", "ACTIVE_DATE", "INACTIVE_DATE", "TEST_FLAG", "FOREIGN_CODE")VALUES ( '''|| RATE_CLASS||''','''||ELEMENT_ID||''','''||COMPONENT_ID||''','''||EQUIP_TYPE_CODE||''','''||EQUIP_CLASS_CODE||''','''||CLASS_OF_SERVICE_CODE||''','''||TYPE_ID_RC||''','''||BILLING_FREQUENCY||''','''||CURRENCY_CODE||''','''||RATE||''','''||JURISDICTION||''','''||DISTANCE_INCREMENT||''','''||UNITS_TYPE||''','''||UNITS_LOWER_LIMIT||''','''||UNITS_UPPER_LIMIT||''','''||UNITS_RATE||''','''||POP_LOWER_LIMIT||''','''||POP_UPPER_LIMIT||''','''||DISTANCE_RATE||''','''||ADD_IMPLIED_DECIMALS||''','''||to_char(DATE_CREATED ,'dd-mon-yyyy')||''','''||to_char(ACTIVE_DATE , 'dd-mon-yyyy')||''','''||to_char(INACTIVE_DATE , 'dd-mon-yyyy')||''','''||TEST_FLAG||''','''||FOREIGN_CODE || '''); ' statement from CW_PC_RR where batch_id=$BATCH_ID;
spool CW_NEW_DISCOUNT.sql;
SELECT 'UPDATE RATE_DISCOUNT RDIS SET RDIS.DATE_INACTIVE= (SELECT DISTINCT date_active FROM CW_PC_RD b WHERE RDIS .discount_id=b.discount_id and rownum<2) WHERE DISCOUNT_ID='||CR.DISCOUNT_ID|| ' AND billing_frequency= '||billing_frequency||' AND currency_code= '||currency_code||' AND DATE_INACTIVE IS NULL;' STATEMENT FROM CW_CPF_MODIFY_DISCOUNT_RATES CR where batch_id=$BATCH_ID;
SELECT 'INSERT INTO "RATE_DISCOUNT" ("DISCOUNT_ID", "RATE_CLASS", "RANGE_ORIGIN", "RANGE_TERMINUS", "BILLING_FREQUENCY", "CURRENCY_CODE", "DISCOUNT_PERCENT", "IMPLIED_DECIMALS", "DISCOUNT_AMOUNT", "DATE_ACTIVE", "DATE_INACTIVE", "DATE_CREATED", "LOOKUP_THRESHOLD_TIER_ID", "QUALIFYING_THRESHOLD_TIER_ID") VALUES ('''||DISCOUNT_ID||''','''|| RATE_CLASS||''','''||RANGE_ORIGIN||''','''||RANGE_TERMINUS||''','''||BILLING_FREQUENCY||''','''||CURRENCY_CODE||''','''||DISCOUNT_PERCENT||''','''||IMPLIED_DECIMALS||''','''||DISCOUNT_AMOUNT||''','''||to_char(DATE_ACTIVE , 'dd-mon-yyyy')||''','''||'' ||''','''||to_char(DATE_ACTIVE , 'dd-mon-yyyy')||''','''||LOOKUP_THRESHOLD_TIER_ID||''','''||QUALIFYING_THRESHOLD_TIER_ID||''');' statement from CW_PC_RD where batch_id=$BATCH_ID;
spool CW_NEW_UNIT_CREDIT.sql;
SELECT 'UPDATE RATE_UNIT_CR RDIS SET RDIS.DATE_INACTIVE = (SELECT DISTINCT date_active FROM CW_PC_RUC b WHERE b.unit_cr_id=rdis.UNIT_CR_ID and rownum<2) WHERE UNIT_CR_ID='||CR.DISCOUNT_ID|| ' AND billing_frequency= '||billing_frequency||' AND DATE_INACTIVE IS NULL;' STATEMENT FROM CW_CPF_MODIFY_UNITCREDIT_RATES CR where batch_id=$BATCH_ID;
SELECT 'INSERT INTO "RATE_UNIT_CR" ("UNIT_CR_ID", "RATE_CLASS", "RANGE_ORIGIN", "RANGE_TERMINUS", "BILLING_FREQUENCY", "CURRENCY_CODE", "UNITS_FREE", "AMOUNT_FREE", "DATE_ACTIVE", "DATE_INACTIVE") VALUES ('''||UNIT_CR_ID||''','''||RATE_CLASS||''','''||RANGE_ORIGIN||''','''||RANGE_TERMINUS||''','''||BILLING_FREQUENCY||''','''||CURRENCY_CODE||''','''||UNITS_FREE||''','''||AMOUNT_FREE||''','''||to_char(DATE_ACTIVE , 'dd-mon-yyyy')||''','''||to_char(DATE_ACTIVE , 'dd-mon-yyyy')||''');' statement from CW_PC_RUC where batch_id=$BATCH_ID;
spool CW_NEW_TARIFF_RATE.sql;
SELECT 'UPDATE TARIFF_RATE TR SET TR.DATE_INACTIVE = (SELECT DISTINCT date_active FROM CW_PC_TR b where tr.tariff_id=b.tariff_id and tr.bundle_id=b.bundle_id and rownum<2) WHERE TARIFF_ID='||CR.TARIFF_ID||' AND BUNDLE_ID='||CR.BUNDLE_ID||' AND DATE_INACTIVE IS NULL;' STATEMENT FROM CW_OLD_TARIFF_SELF_OPT_RATES CR;
SELECT 'INSERT INTO "TARIFF_RATE" ("TARIFF_ID", "BUNDLE_ID","CHARGE_AMOUNT","CURRENCY_CODE","IMPLIED_DECIMALS","DATE_ACTIVE","DATE_CREATED") VALUES ('''||TARIFF_ID||''','''||BUNDLE_ID||''','''||CHARGE_AMOUNT||''','''||CURRENCY_CODE||''','''||IMPLIED_DECIMALS||''','''||DATE_ACTIVE||''','''||DATE_CREATED||''');' statement from CW_PC_TR where batch_id=$BATCH_ID;
SELECT 'UPDATE TARIFF_RATE_BAND TRB SET TRB.STEP='||DECODE(STEP,'','NULL',STEP)||',TRB.RANGE_ORIGIN='||DECODE(RANGE_ORIGIN,'','NULL',RANGE_ORIGIN)||',TRB.RANGE_TERMINUS='||DECODE(RANGE_TERMINUS,'','NULL',RANGE_TERMINUS)||' WHERE TRB.TARIFF_ID='||TARIFF_ID||' AND TRB.AGGREGATION_KEY='||AGGREGATION_KEY||' AND TRB.BUNDLE_ID='||BUNDLE_ID||';' STATEMENT FROM CW_NEW_TARIFF_SELF_OPT_RATES where batch_id=$BATCH_ID;
spool CW_NEW_USAGE_RATES.sql;
SELECT 'UPDATE RATE_USAGE RU SET RU.INACTIVE_DT= (SELECT DISTINCT active_dt FROM CW_PC_RU b where ru.component_id=b.component_id and ru.type_id_usg=b.type_id_usg and ru.jurisdiction=b.jurisdiction and rownum<2 ) WHERE SEQNUM='||SEQNUM||'AND INACTIVE_DT IS NULL;' STATEMENT FROM CW_OLD_USAGE_RATES WHERE batch_id=$BATCH_ID;
select 'INSERT INTO "RATE_USAGE" ("SEQNUM", "RATE_CLASS", "TYPE_ID_USG", "BILL_CLASS","JURISDICTION","POINT_CLASS_TARGET","POINT_CLASS_ORIGIN","UNITS_INDICATOR","PROVIDER_CLASS","RATE_PERIOD","CURRENCY_CODE","ELEMENT_ID","EQUIP_TYPE_CODE","EQUIP_CLASS_CODE","CLASS_OF_SERVICE_CODE","FIXED_CHARGE_AMT","ADD_FIXED_AMT","ADD_UNIT_RATE","ACTIVE_DT","INACTIVE_DT","CREATE_DT","CHANGE_DT","CHANGE_WHO","INCREMENTAL_BANDS","RATE_UNITS_TYPE","DISTANCE_BAND_ID","ZONE_CLASS","ADD_IMPLIED_DECIMAL","IS_DEFAULT_RATE","COMPONENT_ID","BILLING_UNITS_TYPE","MIN_CHARGE_AMT","ADD_MIN_AMT") VALUES ('''||SEQNUM||''','''||RATE_CLASS||''','''||TYPE_ID_USG||''','''||BILL_CLASS||''','''||JURISDICTION||''','''||POINT_CLASS_TARGET||''','''||POINT_CLASS_ORIGIN||''','''||UNITS_INDICATOR||''','''||PROVIDER_CLASS||''','''||RATE_PERIOD||''','''||CURRENCY_CODE||''','''||ELEMENT_ID||''','''||EQUIP_TYPE_CODE||''','''||EQUIP_CLASS_CODE||''','''||CLASS_OF_SERVICE_CODE||''','''||FIXED_CHARGE_AMT||''','''||ADD_FIXED_AMT||''','''||ADD_UNIT_RATE||''','''||ACTIVE_DT||''','''||INACTIVE_DT||''','''||CREATE_DT||''','''||CHANGE_DT||''','''||CHANGE_WHO||''','''||INCREMENTAL_BANDS||''','''||RATE_UNITS_TYPE||''','''||DISTANCE_BAND_ID||''','''||ZONE_CLASS||''','''||ADD_IMPLIED_DECIMAL||''','''||IS_DEFAULT_RATE||''','''||COMPONENT_ID||''','''||BILLING_UNITS_TYPE||''','''||MIN_CHARGE_AMT||''','''||ADD_MIN_AMT || ''') ;' statement from CW_PC_RU where batch_id=$BATCH_ID;
select 'INSERT INTO "RATE_USAGE_BANDS" ("SEQNUM", "RATEBAND", "UNIT_RATE", "NUM_UNITS") VALUES ('''||SEQNUM||''','''||RATEBAND||''','''||UNIT_RATE||''','''||NUM_UNITS||''') ;' statement from CW_PC_RUB where batch_id=$BATCH_ID ORDER BY RATEBAND ASC;
spool CW_NEW_FUP.sql
SELECT 'UPDATE CW_VGE_FUP_REF_DATA SET TOLERANCE='''||TOLERANCE||''',PRICE_DELTA='''||PRICE_DELTA||''',FUP_LOWER='''||FUP_LOWER||''',ALLOWANCE='''||ALLOWANCE||''' WHERE UNIT_CR_ID='||UNIT_CR_ID|| ';' STATEMENT FROM CW_PC_FUP where batch_id=$BATCH_ID;
spool off
quit
THEEND
echo "SQL files are created for INSTALL" >>$log_file
echo "@CW_NEW_MRC.sql" >>sql_list.sql
echo "@CW_NEW_DISCOUNT.sql" >>sql_list.sql
echo "@CW_NEW_UNIT_CREDIT.sql" >>sql_list.sql
echo "@CW_NEW_TARIFF_RATE.sql" >>sql_list.sql
echo "@CW_NEW_USAGE_RATES.sql" >>sql_list.sql
echo "@CW_NEW_FUP.sql" >>sql_list.sql
cd $ROLLBACK_DIR/SQL/
echo 'Going to Connect to database'
touch display.log
sqlplus $ARBOR_USR/`cat $ARBORDIR/.arborpw`@$ORACLE_SID << THEEND >>display.log
clear buffer;
set define off;
set linesize 3000;
set head off;
set feed off
set feedback off;
COLUMN HEADING OFF
column HEADER truncated
column FOOTER truncated
spool CW_OLD_MRC.sql;
SELECT 'DELETE FROM RATE_RC WHERE INACTIVE_DATE=NULL AND ELEMENT_ID=' ||ELEMENT_ID||' AND COMPONENT_ID='||COMPONENT_ID|| '; ' STATEMENT FROM CW_PC_RR where batch_id=$BATCH_ID;
SELECT 'UPDATE RATE_RC SET INACTIVE_DATE=NULL WHERE ELEMENT_ID='||MEMBER_ID||' AND COMPONENT_ID= '||COMPONENT_ID||';' STATEMENT FROM CW_OLD_MRC_RATES where batch_id=$BATCH_ID;
spool CW_OLD_DISCOUNT.sql;
SELECT 'DELETE FROM RATE_DISCOUNT WHERE INACTIVE_DATE=NULL AND DISCOUNT_ID=' ||DISCOUNT_ID|| '; ' STATEMENT FROM CW_PC_RD where batch_id=$BATCH_ID;
SELECT 'UPDATE RATE_DISCOUNT RDIS SET RDIS.DATE_INACTIVE= null WHERE DISCOUNT_ID='||CR.DISCOUNT_ID|| ';' STATEMENT FROM CW_CPF_MODIFY_DISCOUNT_RATES CR where batch_id=$BATCH_ID;
spool CW_OLD_UNIT_CREDIT.sql;
SELECT 'DELETE FROM RATE_UNIT_CR WHERE INACTIVE_DATE=NULL AND UNIT_CR_ID=' ||UNIT_CR_ID|| '; ' STATEMENT FROM CW_PC_RUC where batch_id=$BATCH_ID;
SELECT 'UPDATE RATE_UNIT_CR RDIS SET RDIS.DATE_INACTIVE= null WHERE UNIT_CR_ID='||CR.DISCOUNT_ID|| ';' STATEMENT FROM CW_CPF_MODIFY_UNITCREDIT_RATES CR where batch_id=$BATCH_ID;
spool CW_OLD_TARIFF_RATE.sql;
SELECT 'DELETE FROM TARIFF_RATE WHERE DATE_INACTIVE= NULL AND TARIFF_ID='||CR.TARIFF_ID||' AND BUNDLE_ID='||CR.BUNDLE_ID||'; ' STATEMENT FROM CW_PC_TR CR where batch_id=$BATCH_ID;
SELECT 'UPDATE TARIFF_RATE TR SET TR.DATE_INACTIVE= NULL WHERE TARIFF_ID='||CR.TARIFF_ID||' AND BUNDLE_ID='||CR.BUNDLE_ID||' ;' STATEMENT FROM CW_OLD_TARIFF_SELF_OPT_RATES CR where batch_id=$BATCH_ID;
select 'UPDATE TARIFF_RATE_BAND TRB SET TRB.STEP='||decode(STEP,'','NULL',STEP)||',TRB.RANGE_ORIGIN='||decode(RANGE_ORIGIN,'','NULL',RANGE_ORIGIN)||',TRB.RANGE_TERMINUS='||decode(RANGE_TERMINUS,'','NULL',RANGE_TERMINUS)||' WHERE TRB.TARIFF_ID='||TARIFF_ID||' AND TRB.AGGREGATION_KEY='||AGGREGATION_KEY||' AND TRB.BUNDLE_ID='||BUNDLE_ID||';' statement from CW_OLD_TARIFF_SELF_OPT_RATES where batch_id=$BATCH_ID;
spool CW_OLD_USAGE_RATES.sql;
SELECT 'DELETE FROM RATE_USAGE WHERE SEQNUM = '||RU.SEQNUM|| ';' STATEMENT FROM CW_PC_RU RU where batch_id=$BATCH_ID;
SELECT 'DELETE FROM RATE_USAGE_BANDS WHERE SEQNUM = '||RUB.SEQNUM|| ';' STATEMENT FROM CW_PC_RUB RUB where batch_id=$BATCH_ID;
SELECT 'UPDATE RATE_USAGE RU SET RU.INACTIVE_DT= NULL WHERE SEQNUM='||SEQNUM||';' STATEMENT FROM CW_OLD_USAGE_RATES where batch_id=$BATCH_ID;
spool off
UPDATE CW_PC_BATCH_STATUS SET STATUS = 'PATCH_CREATED' WHERE BATCH_ID=$BATCH_ID;
quit
THEEND
echo "SQL files are created for ROLLBACK" >>$log_file
echo "@CW_OLD_MRC.sql" >>sql_list.sql
echo "@CW_OLD_DISCOUNT.sql" >>sql_list.sql
echo "@CW_OLD_UNIT_CREDIT.sql" >>sql_list.sql
echo "@CW_OLD_TARIFF_RATE.sql" >>sql_list.sql
echo "@CW_OLD_USAGE_RATES.sql" >>sql_list.sql
echo "Patch installed Successfully..">>$log_file
tar -cf $PATCH_DIR/$PATCH_NAME.tar $RELEASE_DIR
cp $PATCH_DIR/$PATCH_NAME.tar $ARBORDIR/cw/delivery
对我来说有些奇怪。请帮忙。
最佳答案
该脚本具有不定向到日志的 echo
语句,但您的 Java 程序没有消耗脚本进程的输出,因此一旦输出缓冲区已满,脚本就会停止。
如果您希望脚本输出到控制台,即与 Java 程序输出相同的输出目的地,您需要使用 ProcessBuilder.inheritIO()
.
无论如何,您应该使用ProcessBuilder
。引用Process
的javadoc :
By default, the created subprocess does not have its own terminal or console. All its standard I/O (i.e. stdin, stdout, stderr) operations will be redirected to the parent process, where they can be accessed via the streams obtained using the methods
getOutputStream()
,getInputStream()
, andgetErrorStream()
. The parent process uses these streams to feed input to and get output from the subprocess. Because some native platforms only provide limited buffer size for standard input and output streams, failure to promptly write the input stream or read the output stream of the subprocess may cause the subprocess to block, or even deadlock.Where desired, subprocess I/O can also be redirected using methods of the
ProcessBuilder
class.As of 1.5,
ProcessBuilder.start()
is the preferred way to create aProcess
.
关于java - shell脚本没有完全从java执行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33983675/
我正在编写一个具有以下签名的 Java 方法。 void Logger(Method method, Object[] args); 如果一个方法(例如 ABC() )调用此方法 Logger,它应该
我是 Java 新手。 我的问题是我的 Java 程序找不到我试图用作的图像文件一个 JButton。 (目前这段代码什么也没做,因为我只是得到了想要的外观第一的)。这是我的主课 代码: packag
好的,今天我在接受采访,我已经编写 Java 代码多年了。采访中说“Java 垃圾收集是一个棘手的问题,我有几个 friend 一直在努力弄清楚。你在这方面做得怎么样?”。她是想骗我吗?还是我的一生都
我的 friend 给了我一个谜语让我解开。它是这样的: There are 100 people. Each one of them, in his turn, does the following
如果我将使用 Java 5 代码的应用程序编译成字节码,生成的 .class 文件是否能够在 Java 1.4 下运行? 如果后者可以工作并且我正在尝试在我的 Java 1.4 应用程序中使用 Jav
有关于why Java doesn't support unsigned types的问题以及一些关于处理无符号类型的问题。我做了一些搜索,似乎 Scala 也不支持无符号数据类型。限制是Java和S
我只是想知道在一个 java 版本中生成的字节码是否可以在其他 java 版本上运行 最佳答案 通常,字节码无需修改即可在 较新 版本的 Java 上运行。它不会在旧版本上运行,除非您使用特殊参数 (
我有一个关于在命令提示符下执行 java 程序的基本问题。 在某些机器上我们需要指定 -cp 。 (类路径)同时执行java程序 (test为java文件名与.class文件存在于同一目录下) jav
我已经阅读 StackOverflow 有一段时间了,现在我才鼓起勇气提出问题。我今年 20 岁,目前在我的家乡(罗马尼亚克卢日-纳波卡)就读 IT 大学。足以介绍:D。 基本上,我有一家提供簿记应用
我有 public JSONObject parseXML(String xml) { JSONObject jsonObject = XML.toJSONObject(xml); r
我已经在 Java 中实现了带有动态类型的简单解释语言。不幸的是我遇到了以下问题。测试时如下代码: def main() { def ks = Map[[1, 2]].keySet()
一直提示输入 1 到 10 的数字 - 结果应将 st、rd、th 和 nd 添加到数字中。编写一个程序,提示用户输入 1 到 10 之间的任意整数,然后以序数形式显示该整数并附加后缀。 public
我有这个 DownloadFile.java 并按预期下载该文件: import java.io.*; import java.net.URL; public class DownloadFile {
我想在 GUI 上添加延迟。我放置了 2 个 for 循环,然后重新绘制了一个标签,但这 2 个 for 循环一个接一个地执行,并且标签被重新绘制到最后一个。 我能做什么? for(int i=0;
我正在对对象 Student 的列表项进行一些测试,但是我更喜欢在 java 类对象中创建硬编码列表,然后从那里提取数据,而不是连接到数据库并在结果集中选择记录。然而,自从我这样做以来已经很长时间了,
我知道对象创建分为三个部分: 声明 实例化 初始化 classA{} classB extends classA{} classA obj = new classB(1,1); 实例化 它必须使用
我有兴趣使用 GPRS 构建车辆跟踪系统。但是,我有一些问题要问以前做过此操作的人: GPRS 是最好的技术吗?人们意识到任何问题吗? 我计划使用 Java/Java EE - 有更好的技术吗? 如果
我可以通过递归方法反转数组,例如:数组={1,2,3,4,5} 数组结果={5,4,3,2,1}但我的结果是相同的数组,我不知道为什么,请帮助我。 public class Recursion { p
有这样的标准方式吗? 包括 Java源代码-测试代码- Ant 或 Maven联合单元持续集成(可能是巡航控制)ClearCase 版本控制工具部署到应用服务器 最后我希望有一个自动构建和集成环境。
我什至不知道这是否可能,我非常怀疑它是否可能,但如果可以,您能告诉我怎么做吗?我只是想知道如何从打印机打印一些文本。 有什么想法吗? 最佳答案 这里有更简单的事情。 import javax.swin
我是一名优秀的程序员,十分优秀!