250.把java程序的编译和运行都集成到editplus里可以按照如下步骤配置: 1.编译 选菜单tools—configure user tools—add tools--program,然后在下面的menu text里 入"编译",Comand里输入:E:\application\j2sdk1.4.0\bin\javac.exe,argument里点文本框右面的小三角按钮选file name,initial directory里同样点文本框右面的小三角按钮选file directory, 例如:-g $(FileName) 然后选中下面capture output。点下面的apply或ok之后就可以了。为了测试,选菜单file--new--java 就可以自动生成一个Hello World程序,类名就叫Test吧。保存后,用组合键ctrl+1就可 编译这个程序了。程序的一些输出信息会在下面的输出窗口显示显示。2.运行 下面说说如何运行java程序,用上面同样的方法添加一个工具,在下面的menu text里输 "运行",Comand里输入:E:\application\j2sdk1.4.0\bin\java.exe,argument里点文本框右面的小三角按钮选File Name with out extention,initial directory里同样点文本框右面的小三角按钮选file directory, 例如:$(FileNameNoExt) 然后选中下面的capture output。点下面的apply或ok之后就可以了。 测试时如果你的Test类已经在上一步编译好了,你可以直接ctrl+2就可以运行Test。3)调试 在设置这个功能之前一定要在编译中加入-g。 用上面同样的方法添加一个工具,在下面的menu text里输 "调试",Comand里输入:E:\application\j2sdk1.4.0\bin\jdb.exe,argument里点文本框右面的小三角按钮选-classpath File Ddirectory File Name without extention。 例如:-classpath $(FileDir) $(FileNameNoExt) 点下面的apply或ok之后就可以了。测试时如果你的Test类已经在上一步编译好了,你可以直接ctrl+2就可以运行Test。 jdb部分命令的使用 可能参考:F:\Net\java下载\CSDN的经典文摘\CSDN经典文摘1\JDB的简单使用.mht 1)设置断点 stop at debugtest.hehe:18 stop in debugtest.test.add2)打印变量 print bf.abc print i 3)打印类变量 dump kk 4)list 显示当前的指针位置 5)locals 显示当前所有局部变量 5)执行后一句 next 6)单步进入 step 7)打印一个类的方法 methods test 8)打印一个类的成员变量 fields test 9)一直运行到下一个断点,如果没有,则运行到结束 cont 10)退出 quit例程如下: package debugtest; class test { int a; int b; test(int aa,int bb) { a = aa; b = bb; } int add(){ int c=a+b; return c; } } public class hehe { public static void main(String args[]) { int a = 2; int b = 3; int c= a+b; System.out.println("a= "+a); System.out.println("b= "+b); System.out.println("c= a+b= "+c); test kk=new test(1,2); System.out.println("kk.add()= "+kk.add()); } }
我调出jdb,显示Initializing jdb... 敲入命令: stop at debugtest.hehe:18 显示 Deferring breakpoint debugtest.hehe:18 It will be set after the class is loaded 敲入命令 stop in debugtest.test.add 显示 Deferring breakpoint debugtest.test.add It will be set after the class is loaded 敲入其他命令,如 print bf.abc print i dump kk list locals next step methods test fields test cont 怎么都是显示 Command '命令' is not valid until the VM is started with the 'run' command 呀,这是为什么啊?
}*/ String connectto= args[0]; Socket connection; // connect to server if(connectto.equals("localhost")){ connection=new Socket(InetAddress.getLocalHost(),5000);} else{ connection=new Socket(InetAddress.getByName(connectto),5000); } DataInputStream input=new DataInputStream(connection.getInputStream());// read information from server String info; info = input.readUTF(); System.out.println(info); connection.close(); } catch(SecurityException e){ System.out.println("SecurityException when connecting Server!"); } catch(IOException e){ System.out.println("IOException when connecting Server!"); } }}
这样看来,你运行时的参数应该是Client chendong才对
我这个问题怎么没有人回答呢?我调出jdb,显示Initializing jdb... 敲入命令: stop at debugtest.hehe:18 显示 Deferring breakpoint debugtest.hehe:18 It will be set after the class is loaded 敲入命令 stop in debugtest.test.add 显示 Deferring breakpoint debugtest.test.add It will be set after the class is loaded 敲入其他命令,如 print bf.abc print i dump kk list locals next step methods test fields test cont 怎么都是显示 Command '命令' is not valid until the VM is started with the 'run' command 呀,这是为什么啊?
1.编译
选菜单tools—configure user tools—add tools--program,然后在下面的menu text里
入"编译",Comand里输入:E:\application\j2sdk1.4.0\bin\javac.exe,argument里点文本框右面的小三角按钮选file name,initial directory里同样点文本框右面的小三角按钮选file directory,
例如:-g $(FileName)
然后选中下面capture output。点下面的apply或ok之后就可以了。为了测试,选菜单file--new--java
就可以自动生成一个Hello World程序,类名就叫Test吧。保存后,用组合键ctrl+1就可
编译这个程序了。程序的一些输出信息会在下面的输出窗口显示显示。2.运行
下面说说如何运行java程序,用上面同样的方法添加一个工具,在下面的menu text里输
"运行",Comand里输入:E:\application\j2sdk1.4.0\bin\java.exe,argument里点文本框右面的小三角按钮选File Name with
out extention,initial directory里同样点文本框右面的小三角按钮选file directory,
例如:$(FileNameNoExt)
然后选中下面的capture output。点下面的apply或ok之后就可以了。
测试时如果你的Test类已经在上一步编译好了,你可以直接ctrl+2就可以运行Test。3)调试
在设置这个功能之前一定要在编译中加入-g。 用上面同样的方法添加一个工具,在下面的menu text里输
"调试",Comand里输入:E:\application\j2sdk1.4.0\bin\jdb.exe,argument里点文本框右面的小三角按钮选-classpath File Ddirectory File Name without extention。
例如:-classpath $(FileDir) $(FileNameNoExt)
点下面的apply或ok之后就可以了。测试时如果你的Test类已经在上一步编译好了,你可以直接ctrl+2就可以运行Test。
jdb部分命令的使用
可能参考:F:\Net\java下载\CSDN的经典文摘\CSDN经典文摘1\JDB的简单使用.mht
1)设置断点
stop at debugtest.hehe:18
stop in debugtest.test.add2)打印变量
print bf.abc
print i
3)打印类变量
dump kk
4)list
显示当前的指针位置
5)locals
显示当前所有局部变量
5)执行后一句
next
6)单步进入
step
7)打印一个类的方法
methods test
8)打印一个类的成员变量
fields test
9)一直运行到下一个断点,如果没有,则运行到结束
cont
10)退出
quit例程如下:
package debugtest;
class test
{
int a;
int b;
test(int aa,int bb)
{
a = aa;
b = bb;
}
int add(){
int c=a+b;
return c;
}
}
public class hehe
{
public static void main(String args[])
{
int a = 2;
int b = 3;
int c= a+b; System.out.println("a= "+a);
System.out.println("b= "+b);
System.out.println("c= a+b= "+c);
test kk=new test(1,2);
System.out.println("kk.add()= "+kk.add());
}
}
不知道有没有人知道怎么做,以前听说过有人弄过。
敲入命令:
stop at debugtest.hehe:18
显示
Deferring breakpoint debugtest.hehe:18
It will be set after the class is loaded
敲入命令
stop in debugtest.test.add
显示
Deferring breakpoint debugtest.test.add
It will be set after the class is loaded
敲入其他命令,如
print bf.abc
print i
dump kk
list
locals
next
step
methods test
fields test
cont
怎么都是显示
Command '命令' is not valid until the VM is started with the 'run' command
呀,这是为什么啊?
ant编译真叫那个舒服啊
呵呵
菜单文字:Run Java Program
命令:D:\jdk1.4\bin\java.exe
参数:
初始目录:$(FileDir)
然后选中“捕获输出”及“参数提示”运行的时候在弹出的输入参数对话框里输入参数(包名.类名 arg1 arg2...)
就ok了
---------- 运行 ----------
java.lang.NoClassDefFoundError: Client/chendong
Exception in thread "main"
输出完成 (耗时 0 秒) - 正常终止
--------------------------------------
这是为什么呢?
-----------------------------------------------------------------
import java.io.*;
import java.net.*;public class Client {
public static void main(String args[]) {
try{
System.out.println(args.length);
if (args.length != 1){
System.out.println("USAGE: java Client servername");
//System.exit(0);
return;
//System.exit(1);
}
/*public Client(String[] args){
String servername;
servername=args[0];
}*/
String connectto= args[0];
Socket connection;
// connect to server
if(connectto.equals("localhost")){
connection=new Socket(InetAddress.getLocalHost(),5000);}
else{
connection=new Socket(InetAddress.getByName(connectto),5000);
}
DataInputStream input=new DataInputStream(connection.getInputStream());// read information from server
String info;
info = input.readUTF();
System.out.println(info);
connection.close();
}
catch(SecurityException e){
System.out.println("SecurityException when connecting Server!");
}
catch(IOException e){
System.out.println("IOException when connecting Server!");
}
}}
敲入命令:
stop at debugtest.hehe:18
显示
Deferring breakpoint debugtest.hehe:18
It will be set after the class is loaded
敲入命令
stop in debugtest.test.add
显示
Deferring breakpoint debugtest.test.add
It will be set after the class is loaded
敲入其他命令,如
print bf.abc
print i
dump kk
list
locals
next
step
methods test
fields test
cont
怎么都是显示
Command '命令' is not valid until the VM is started with the 'run' command
呀,这是为什么啊?