To make the compilation and application execution easy, do the following steps: 1) Click Tools menu 2) Select Configure user tools 3) Click Add Tools>> 4) Select Program 5) Enter the following fields: Menu text: Compile JavaFile Command: c:\jdk141\bin\javac.exe -d . Argument: $(FileName) Initial directory: $(FileDir) Check Capture output 6) Click Add Tools>> 7) Select Program 8) Enter the following fields: Menu text: Run Javafile Command: c:\jdk141\bin\java.exe Argument: $(FileNameNoExt) Initial directory: $(FileDir) Check Capture output 9) Click Add Tools>> 10) Select Program 11) Enter the following fields: Menu text: appletviewer Command: c:\jdk141\bin\appletviewer.exe Argument: $(FileName) Initial directory: $(FileDir) Check Capture output 12) Click OK 13) Edit your Java code ans save it 14) Press Ctrl-1 to compile your code (or select from Tools menu) 15) Press Ctrl-2 to run your compiled application code (or select from Tools menu) 16) Press Ctrl-3 to appletviewer on your html file (or select from Tools menu)
谢谢 yjs_lh!又长见识了!!
我的源码(太简单了): public class helloworld { public static void main(String[] args) { System.out.println("Hello World!"); } } 直接用命令行的方式没错的,我试了,但在这怎么不行,太郁闷了
2) Select Configure user tools
3) Click Add Tools>>
4) Select Program
5) Enter the following fields:
Menu text: Compile JavaFile
Command: c:\jdk141\bin\javac.exe -d .
Argument: $(FileName)
Initial directory: $(FileDir)
Check Capture output
6) Click Add Tools>>
7) Select Program
8) Enter the following fields:
Menu text: Run Javafile
Command: c:\jdk141\bin\java.exe
Argument: $(FileNameNoExt)
Initial directory: $(FileDir)
Check Capture output
9) Click Add Tools>>
10) Select Program
11) Enter the following fields:
Menu text: appletviewer
Command: c:\jdk141\bin\appletviewer.exe
Argument: $(FileName)
Initial directory: $(FileDir)
Check Capture output
12) Click OK
13) Edit your Java code ans save it
14) Press Ctrl-1 to compile your code (or select from Tools menu)
15) Press Ctrl-2 to run your compiled application code (or select from Tools menu)
16) Press Ctrl-3 to appletviewer on your html file (or select from Tools menu)
public class helloworld
{
public static void main(String[] args)
{
System.out.println("Hello World!");
}
}
直接用命令行的方式没错的,我试了,但在这怎么不行,太郁闷了
Count=4
Text=j2sdk1.4.2_02
[Tools\0\0]
Text=Running Java File
Command=C:\j2sdk1.4.2_02\bin\java.exe
Argument=-classpath $(FileDir) $(FileNameNoExt)
InitDir=$(FileDir)
RedirOut=1
Prompt=0
Plugin=0
Pattern=131328
Pattern Regex=^([^(]+):([0-9]+):
Close=0
Help=0
[Tools\0\1]
Text=Running Java File with Parameter
Command=C:\j2sdk1.4.2_02\bin\java.exe
Argument=-classpath $(FileDir) $(FileNameNoExt)
InitDir=$(FileDir)
RedirOut=1
Prompt=1
Plugin=0
Pattern=0
Pattern Regex=
Close=0
Help=0
[Tools\0\2]
Text=Compile Java File
Command=C:\j2sdk1.4.2_02\bin\javac.exe
Argument=$(FilePath)
InitDir=$(FileDir)
RedirOut=1
Prompt=0
Plugin=0
Pattern=0
Pattern Regex=
Close=0
Help=0
[Tools\0\3]
Text=JavaH
Command=C:\j2sdk1.4.2_02\bin\javah.exe
Argument=-classpath $(FileDir) $(FileNameNoExt)
InitDir=$(FileDir)
RedirOut=1
Prompt=0
Plugin=0
Pattern=0
Pattern Regex=
Close=0
Help=0
你看看你的classpath是什么
Exception in thread "main" java.lang.NoClassDefFoundError: Helloword/java代码:
public class Helloword
{
public static void main(String[] args)
{
System.out.println("Hello World!");
}
}
参数那里是选择$(FileNameNoExt)
也就是文件名不带扩展名
不要选成文件名的全名了
我已经试出来了,配置如下:
菜单名称:编译类
命令:C:\JBuilder9\jdk1.4\bin\javac.exe
参数:文件目录(或为空)
初始目录:文件目录菜单名称:运行类
命令:C:\JBuilder9\jdk1.4\bin\java.exe
参数:-classpath $(FileDir) $(FileNameNoExt)
初始目录:文件目录