i*****e 发帖数: 2810 | 1
Your can use:
Process p = Runtime.getRuntime().exec("your command");
first. Then get IOStream from this process to read/write info. |
|
b********y 发帖数: 3 | 2 I wanna test if there is a duplicate instance running.
So, I am trying to call the following unix commands,
ps acx > ./ps_Client.txt
and
grep -c Client ./ps_Client.txt > ./grep_Client.txt
but when I try to open the file grep_Client.txt, I got the
FileNotFoundException, there is no such file at all.
The follows are my code,
String SysCommand = "ps acx > ./ps_Client.txt";
Process p = Runtime.getRuntime().exec(SysCommand);
SysCommand = "grep -c Client ./ps_Client.txt > ./grep_Client.txt";
Process p |
|
x******o 发帖数: 31 | 3 is there any way that I can run a servlet from command line (like run CGI from
console)?
i am new for java.
thanks, |
|
x******o 发帖数: 31 | 4 thanks!
so there is no way to run from command line, right? |
|
r***l 发帖数: 67 | 5 The answer is Yes and No.
You can use mock object to simulate servlet environment and potentially
run/test your servlet without servlet container. However, that's more about
unit testing and it is an advanced topic.
Since you said you are new for Java, I do not want to confuse you here. So,
the answer is No. You can not run servlet from command line (without servlet
container). hehe
CGI |
|
d********r 发帖数: 199 | 6 想起几年以前的糗事:
几年前servlet技术刚出来的时候我就开始用了,但还不会在线调试。
写好code编译后在服务器上跑,靠写log文件进行debug,那叫一个累啊。
后来发现可以在JBuilder里run一个Java Web Server,
通过配置让servlet在Java Web Server里运行,(相当于自己配了一个container)
这样就实现了在IDE环境里调试,那叫一个爽啊。
真后悔没早点引进这个“先进技术”。
而且那时还没有log4j,code里无数的 log语句,简直惨不忍睹。
现在回想起来不堪回首啊。
依赖别的实现,要运行需要container提供环境。启动container当然可以通过command
run |
|
y********o 发帖数: 2565 | 7 Look, buddy:
发信人: goodbug (好虫), 信区: Java
标 题: No decent way for input password from command line.
发信站: BBS 未名空间站 (Tue Nov 21 11:25:52 2006), 转信
Sun sucks big time. I can't wait until 1.6 is out. |
|
w******t 发帖数: 69 | 8 有个command line application,想直接拿来用,不改动程序, 但是想用WIDGET来做UI.
我考虑的方案是用一个local web server来实现widget 和这个程序的通信. WIDGET
通过web server去调用这个程序, 这部分没有问题. 但是反过来CALLBACK怎样实现? 这
个程序的EVENT怎样发送给WIDGET?
请高手支招!
谢谢! |
|
m******t 发帖数: 2416 | 9 Why can't the "widget" talk to the command line app directly - via, for
instance, pipes? |
|
g*****g 发帖数: 34805 | 10 sure, Runtime.getRuntime().exec("your command") |
|
b******y 发帖数: 9224 | 11 I got so rustic with javac command line, and being thinking about how to
compile java code starting from a certain root directory.
Could anyone help and let me know how to do that?
is it like:
javac mydir/*.java
? |
|
g*****g 发帖数: 34805 | 12 Write ant script, and run ant from command line. |
|
g*****g 发帖数: 34805 | 13 The trick is to use a script to put down your command,
then use java to call that script.
file2. |
|
c**o 发帖数: 186 | 14 I have a command like this,
EXECCMD="${XTERMCMD} ${JAVA_HOME}/bin/java -classpath ${GCLASSPATH} ... ${
EXECLASS} $*"
I don't know what it is $*.
it will be run on linux os.
Thanks. |
|
g*****g 发帖数: 34805 | 15 Put the command in a script file, and run that script instead,
it's probably easier that way. |
|
h*****0 发帖数: 4889 | 16 when you get complicated options in you command, try to use this edition of
exec:
Runtime.exec(String[] cmdarray) |
|
S*******h 发帖数: 7021 | 17 1. 在Eclipse Run > Run Configuration > Arguments >VM arguments那栏里加 java-
ea HelloWorld
结果反回
java.lang.NoClassDefFoundError: java
Caused by: java.lang.ClassNotFoundException: java
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoa... 阅读全帖 |
|
i**p 发帖数: 902 | 18 Linux bash. a command line is this,
. cs_script.sh
What is the function of the "." ? |
|
s*****k 发帖数: 604 | 19 vim 里面进入visual模式后选择然后按冒号进入command line后的那个 '<,'> 是什
么意思? |
|
s****n 发帖数: 700 | 20 put program command after time could run the program and summarize system
resource usage such as real time, system time and user time.
It will give the report after the program finish its process. However I want
to know if there is a tool which can check the system resouce uasge of the
program while it's still running.
Your help is appreciated. |
|
l********r 发帖数: 175 | 21 I like to replace ' with * using sed command, how to do it? Thanks a
lot.
sed 's/'/*/g' file > file-new;
could not work.
sed 's/\'/*/g' file > file-new;
could not work either. |
|
p*****s 发帖数: 344 | 22 basically you want your terminal act like a browser environment, which is
not a bad idea and can be easily implemented.
it
(PS) to
command |
|
b*****l 发帖数: 9499 | 23 不好的地方在于,以前的 command 的结果就被抹掉了。
现在的方式有很多好处,比如说,screen 下可以向上翻屏看历史,等等。
it
to
to |
|
|
g*******0 发帖数: 127 | 25 I want to write a script so that after the completion of running my program
in Ubuntu, an email with the result log file as attachment will be sent to
my gmail account. Is there any good program that I can use to send an email
with command line? |
|
e******d 发帖数: 310 | 26 Thank you a lot
what does option "-o" mean?
it seems this command does not work |
|
d**e 发帖数: 863 | 27 I Googled, there were two solutions:
1) switchdesk KDE;
2) edit /etc/sysconfig/dekstop;
1) no such command; 2) no such file.
I can start/select if booting to level 5, but due to other
problem, I prefer boot to level 3. Thanks. |
|
b*******f 发帖数: 428 | 28 一个文件,里面有
...
INFO [#10001] : XXXXXXXXXXXXXX
: Y1Y1Y1Y1Y1Y1Y1
INFO [#10001] : XXXXXXXXXXXXXX
: Y2Y2Y2Y2Y2Y2Y2
WARN [#30001] : XXXXXXXXXXXXXXXXXX
: Y3Y3Y3Y3Y3Y3Y3
(Y1Y1Y1Y1Y1Y1Y1和Y3Y3Y3Y3Y3Y3Y3是信息第一次出现的第二行,用grep "[#10001]" -
m 1 -A 1 可以抓到)
想用一行command,pipeline提取出结果,最后是这样的:(第一列是统计数量)
2 [#10001] INFO : Y1Y1Y1Y1Y1Y1
1 [#30001] WARN: Y3Y3Y3Y3Y3Y3
请问如何做到?用perl也行
鼓弄了半天,现在只能做到
2 [#10001] INFO :
1 [#30001] WARN:
多谢! |
|
c***y 发帖数: 615 | 29 有些command line 参数很复杂, 想每次用完后能生成个文件做个记录,现在只知道copy
/paste, 不知道有更方便,更专业的方法没有? 多谢 |
|
v*****r 发帖数: 1119 | 30 如果是常用的command 的话,应该还在 history 里,CTRL+R 作个 reverse search 很
容易就找出来了
copy |
|
w*s 发帖数: 7227 | 31 Hi, someone mentioned this last time,
the latest ubuntu is using network-manager to set static/dhcp.
So i cannot use command line to change this anymore ?
BTW,
in /etc/network/interfaces,
i only see
auto lo
iface lo inet loopback
nothing configured for eth0.
But when i boot up, it's using dhcp ?
Where does it get the configuration now ? |
|
d**o 发帖数: 864 | 32 请教一个,这个graph command是什么东西? |
|
a*s 发帖数: 425 | 33 就是用command line运行一个程序,
但是,不想等着它运行完,
换句话说想让这个程序后台运行
好像记得加什么符号就可以了
有没有人知道啊
系诶下 |
|
i***r 发帖数: 1035 | 34 this one is good. excite the last awk command |
|
A**u 发帖数: 2458 | 35 原来你还是版斧啊
但是 用ubuntu这种大路货,不能显示linux版主精湛的
command line水平了
应该gentoo, 最起码 arch吧 |
|
j*********e 发帖数: 811 | 36 I run a bash-script with command:
for con in 'seq 50 50 300'...
do
replace "count" $ con
compile
run "10" "con_cnt$con"
done
but the result shows, it runs 10 times at 50,100,200,300
by 150 and 250 only 9 times
then I changed a condition, and this time, it runs 10 times at 50,100,150,
300
by 200 and 250 only 8 times
I read the couu_log.txt, and there are several places, that without the sign
why? |
|
g**********y 发帖数: 14569 | 37 Anyone know how to handle Briefcase from command line or shell script? Like
display detail for a file pointer, create a Briefcase, etc. Any website
pointer is appreciated. |
|
|
w******g 发帖数: 82 | 39 【 以下文字转载自 Linux 讨论区 】
发信人: wenxiang ( ), 信区: Linux
标 题: 求助:script for commands
发信站: BBS 未名空间站 (Tue Jul 10 09:28:07 2007)
最近在run一个ns2 based的simulation.我写了一个外挂的matlab程序产生scenario和
分析数据.所输入命令大概是这样的
nohup matlab /dev/null
ns file.tcl
awk -f handle_trace.awk output_trace.tr > extracted_trace.txt
nohup matlab /dev/null
为了完成和分析一次simulation,我需要依次输入上面几个命令。我现在想一次run上
100次simulation。请问有没有办法写个script什么的,让unix/linux系统顺次运行这
些命令100遍。如果可以,大概是什么样的?谢谢! |
|
i**p 发帖数: 902 | 40 【 以下文字转载自 Linux 讨论区 】
发信人: isup (No), 信区: Linux
标 题: find command
发信站: BBS 未名空间站 (Thu Feb 28 00:17:41 2008)
怎样一次删除一个用户创建的所有文件? |
|
r**o 发帖数: 481 | 41 【 以下文字转载自 Windows 讨论区 】
发信人: roro (yoyo~Madredeus-Miradouro de Santa Catar), 信区: Windows
标 题: Is there some command t run at the background
发信站: BBS 未名空间站 (Wed Apr 23 14:34:05 2008)
like Unix &? @@ Thanks. |
|