当前位置: 技术问答>java相关
How to run Java applications in command line?
来源: 互联网 发布时间:2015-01-23
本文导语: 主 题:How to run Java applications ? 作 者:Kelvin9230 所属论坛:Java 问题点数:24 回复次数:8 人气指数:54 发表时间:2001-8-10 11:09:48 I use JBuilder2 to compile an application generated by application wizard. It outputs...
主 题:How to run Java applications ?
作 者:Kelvin9230
所属论坛:Java
问题点数:24
回复次数:8
人气指数:54
发表时间:2001-8-10 11:09:48
I use JBuilder2 to compile an application generated by application wizard. It outputs some class files. What I want to know is how can I use Java virtual machine to load the application and run it. I setup the environments correctlly. But, when I use jre.exe to run the application in command line, an error information will show: Class not found. I began to learn Java 3 days ago. So this information confuses me. Is there anyone who can tell me how to do ? I have referenced the help documents, but it does not work.
回复贴子:
hexiaofeng(java爱好者) 回复于2001-8-10 12:37:18 得24分
javac j.java
java j
panq() 回复于2001-8-10 12:43:02 得0分
把class所在的路径 设到classpath中
如果是jdk1.3只用设path中
kare(小李飞刀的飞,小李飞刀的刀。) 回复于2001-8-10 13:20:41 得0分
C:Borlandjbuilder5jdk1.3binjavaw -classpath "D:KareAutoAnswerclasses;C:Borlandjbuilder5libjbcl.jar;C:Borlandjbuilder5libdx.jar;C:Borlandjbuilder5libbeandt.jar;C:Borlandjbuilder5jdk1.3demojfcJava2DJava2Demo.jar;C:Borlandjbuilder5jdk1.3jrelibi18n.jar;C:Borlandjbuilder5jdk1.3jrelibjaws.jar;C:Borlandjbuilder5jdk1.3jrelibrt.jar;C:Borlandjbuilder5jdk1.3jrelibsunrsasign.jar;C:Borlandjbuilder5jdk1.3libdt.jar;C:Borlandjbuilder5jdk1.3libtools.jar" yourPackage.mainclassname
这是用JB5,JB2只需将相应的.jar及其路径改一下就可以了,建议你用JB5吧
Kelvin9230() 回复于2001-8-10 13:23:50 得0分
To : hexiaofeng(java爱好者)
I successfully compiled test.java, but can not run it. Error message are printed. I do what panq told me, but also failed.
D:javaprojtest>javac test.java
AppAccelerator(tm) 1.1.034 for Java (JDK 1.1), x86 version.
Copyright (c) 1998 Borland International. All Rights Reserved.
D:javaprojtest>java test
AppAccelerator(tm) 1.1.034 for Java (JDK 1.1), x86 version.
Copyright (c) 1998 Borland International. All Rights Reserved.
Can't find class test
D:javaprojtest>
The following is the directory that contains my application.
D:javaprojtest>dir
Volume in drive D is WINDOWS98
Volume Serial Number is 1272-1BE2
Directory of D:javaprojtest
. 08-10-01 11:17 .
.. 08-10-01 11:17 ..
OPENFILE GIF 1,132 08-10-01 11:17 openFile.gif
HELP GIF 118 08-10-01 11:17 help.gif
CLOSEF~1 GIF 1,154 08-10-01 11:17 closeFile.gif
TEST~1 CLA 1,149 08-10-01 13:11 test.class
TEST~1 JAV 1,442 08-10-01 11:17 test.java
FRAME~1 JAV 2,674 08-10-01 11:17 Frame.java
FRAME~1 CLA 3,371 08-10-01 13:11 Frame.class
FRAME_~2 JAV 3,102 08-10-01 11:17 Frame_AboutBox.java
FRAME$~2 CLA 576 08-10-01 13:11 Frame$1.class
FRAME$~3 CLA 577 08-10-01 13:11 Frame$2.class
FRAME_~2 CLA 3,634 08-10-01 13:11 Frame_AboutBox.class
11 file(s) 18,929 bytes
2 dir(s) 29,360.34 MB free
D:javaprojtest>
To panq:
I do what you told me, but failed. My JDK is version 1.1
Help me please. I want to develop an internet browser using JAVA.
hexiaofeng(java爱好者) 回复于2001-8-10 13:27:57 得0分
set classpath=%ClASSPATH%;.
在运行试试
Kelvin9230() 回复于2001-8-10 13:30:08 得0分
To kare(小李飞刀的飞,小李飞刀的刀。):
The following is my environments. I set it using the batch file "setvars.bat"
D:JBuilder2 is the directory where I install java builder.
D:javaprojtest>set
TMP=C:WINDOWSTEMP
TEMP=C:WINDOWSTEMP
PROMPT=$p$g
winbootdir=C:WINDOWS
COMSPEC=C:COMMAND.COM
windir=C:WINDOWS
BLASTER=A220 I5 D1 T4 P300
PATH=D:JBUILD~1BIN;D:JBUILD~1JAVABIN;C:WINDOWS;C:WINDOWSCOMMAND
CLASSPATH=.;d:jbuilder2bin;d:jbuilder2javabin;d:jbuilder2libjbcl2.0.jar;
d:jbuilder2libjbcl2.0-res.jar;d:jbuilder2libjgl3.1.0.jar;d:jbuilder2libswingall.jar;d:jbuilder2libdatastore2.0.jar;d:jbuilder2libdatastore2.0-res
.jar;d:jbuilder2libjcbwt.jar;d:jbuilder2libjcchart.jar;d:jbuilder2libjc
table.jar;d:jbuilder2libvbjorb.jar;d:jbuilder2libvbjapp.jar;d:jbuilder2l
ibvbjgk.jar;d:jbuilder2libvbjtools.jar;d:jbuilder2samples;d:javaclasses;
d:javaproj;d:jbuilder2javalibclasses.zip;
JAVA_COMPILER=javacomp
JAVA_HOME=d:jbuilder2java
JBUILDER_HOME=d:jbuilder2
CMDLINE=java test
D:javaprojtest>
I think that the environment is no ploblem.
Kelvin9230() 回复于2001-8-10 13:34:56 得0分
To hexiaofeng(java爱好者):
Failed again.
Kelvin9230() 回复于2001-8-10 13:52:24 得0分
Sorry I do know how to add you score.
There is some mistake.
作 者:Kelvin9230
所属论坛:Java
问题点数:24
回复次数:8
人气指数:54
发表时间:2001-8-10 11:09:48
I use JBuilder2 to compile an application generated by application wizard. It outputs some class files. What I want to know is how can I use Java virtual machine to load the application and run it. I setup the environments correctlly. But, when I use jre.exe to run the application in command line, an error information will show: Class not found. I began to learn Java 3 days ago. So this information confuses me. Is there anyone who can tell me how to do ? I have referenced the help documents, but it does not work.
回复贴子:
hexiaofeng(java爱好者) 回复于2001-8-10 12:37:18 得24分
javac j.java
java j
panq() 回复于2001-8-10 12:43:02 得0分
把class所在的路径 设到classpath中
如果是jdk1.3只用设path中
kare(小李飞刀的飞,小李飞刀的刀。) 回复于2001-8-10 13:20:41 得0分
C:Borlandjbuilder5jdk1.3binjavaw -classpath "D:KareAutoAnswerclasses;C:Borlandjbuilder5libjbcl.jar;C:Borlandjbuilder5libdx.jar;C:Borlandjbuilder5libbeandt.jar;C:Borlandjbuilder5jdk1.3demojfcJava2DJava2Demo.jar;C:Borlandjbuilder5jdk1.3jrelibi18n.jar;C:Borlandjbuilder5jdk1.3jrelibjaws.jar;C:Borlandjbuilder5jdk1.3jrelibrt.jar;C:Borlandjbuilder5jdk1.3jrelibsunrsasign.jar;C:Borlandjbuilder5jdk1.3libdt.jar;C:Borlandjbuilder5jdk1.3libtools.jar" yourPackage.mainclassname
这是用JB5,JB2只需将相应的.jar及其路径改一下就可以了,建议你用JB5吧
Kelvin9230() 回复于2001-8-10 13:23:50 得0分
To : hexiaofeng(java爱好者)
I successfully compiled test.java, but can not run it. Error message are printed. I do what panq told me, but also failed.
D:javaprojtest>javac test.java
AppAccelerator(tm) 1.1.034 for Java (JDK 1.1), x86 version.
Copyright (c) 1998 Borland International. All Rights Reserved.
D:javaprojtest>java test
AppAccelerator(tm) 1.1.034 for Java (JDK 1.1), x86 version.
Copyright (c) 1998 Borland International. All Rights Reserved.
Can't find class test
D:javaprojtest>
The following is the directory that contains my application.
D:javaprojtest>dir
Volume in drive D is WINDOWS98
Volume Serial Number is 1272-1BE2
Directory of D:javaprojtest
. 08-10-01 11:17 .
.. 08-10-01 11:17 ..
OPENFILE GIF 1,132 08-10-01 11:17 openFile.gif
HELP GIF 118 08-10-01 11:17 help.gif
CLOSEF~1 GIF 1,154 08-10-01 11:17 closeFile.gif
TEST~1 CLA 1,149 08-10-01 13:11 test.class
TEST~1 JAV 1,442 08-10-01 11:17 test.java
FRAME~1 JAV 2,674 08-10-01 11:17 Frame.java
FRAME~1 CLA 3,371 08-10-01 13:11 Frame.class
FRAME_~2 JAV 3,102 08-10-01 11:17 Frame_AboutBox.java
FRAME$~2 CLA 576 08-10-01 13:11 Frame$1.class
FRAME$~3 CLA 577 08-10-01 13:11 Frame$2.class
FRAME_~2 CLA 3,634 08-10-01 13:11 Frame_AboutBox.class
11 file(s) 18,929 bytes
2 dir(s) 29,360.34 MB free
D:javaprojtest>
To panq:
I do what you told me, but failed. My JDK is version 1.1
Help me please. I want to develop an internet browser using JAVA.
hexiaofeng(java爱好者) 回复于2001-8-10 13:27:57 得0分
set classpath=%ClASSPATH%;.
在运行试试
Kelvin9230() 回复于2001-8-10 13:30:08 得0分
To kare(小李飞刀的飞,小李飞刀的刀。):
The following is my environments. I set it using the batch file "setvars.bat"
D:JBuilder2 is the directory where I install java builder.
D:javaprojtest>set
TMP=C:WINDOWSTEMP
TEMP=C:WINDOWSTEMP
PROMPT=$p$g
winbootdir=C:WINDOWS
COMSPEC=C:COMMAND.COM
windir=C:WINDOWS
BLASTER=A220 I5 D1 T4 P300
PATH=D:JBUILD~1BIN;D:JBUILD~1JAVABIN;C:WINDOWS;C:WINDOWSCOMMAND
CLASSPATH=.;d:jbuilder2bin;d:jbuilder2javabin;d:jbuilder2libjbcl2.0.jar;
d:jbuilder2libjbcl2.0-res.jar;d:jbuilder2libjgl3.1.0.jar;d:jbuilder2libswingall.jar;d:jbuilder2libdatastore2.0.jar;d:jbuilder2libdatastore2.0-res
.jar;d:jbuilder2libjcbwt.jar;d:jbuilder2libjcchart.jar;d:jbuilder2libjc
table.jar;d:jbuilder2libvbjorb.jar;d:jbuilder2libvbjapp.jar;d:jbuilder2l
ibvbjgk.jar;d:jbuilder2libvbjtools.jar;d:jbuilder2samples;d:javaclasses;
d:javaproj;d:jbuilder2javalibclasses.zip;
JAVA_COMPILER=javacomp
JAVA_HOME=d:jbuilder2java
JBUILDER_HOME=d:jbuilder2
CMDLINE=java test
D:javaprojtest>
I think that the environment is no ploblem.
Kelvin9230() 回复于2001-8-10 13:34:56 得0分
To hexiaofeng(java爱好者):
Failed again.
Kelvin9230() 回复于2001-8-10 13:52:24 得0分
Sorry I do know how to add you score.
There is some mistake.
|
come in here