代码如下:
public class Integers {
public static void main(String args[])
{ int a=015;
int b=20;
int c=0x25;
short x=30;
long y=123456L;
System.out.println("a="+a);
System.out.println("b="+b);
System.out.println("c="+c);
System.out.println("x="+x);
System.out.println("y="+y);}
}用javac Integers.java 能编译,用java Integers 是出错,出错信息如下F:\javaexp\JavaStudy\src>java Integers.class
Exception in thread "main" java.lang.NoClassDefFoundError: Integers/class
Caused by: java.lang.ClassNotFoundException: Integers.class
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
Could not find the main class: Integers.class. Program will exit.
环境配置应该是正确的,cmd 下输入 "java -version" "javac" "java" 分别返回 F:\javaexp\JavaStudy\src>java -version
java version "1.6.0_12"
Java(TM) SE Runtime Environment (build 1.6.0_12-b04)
Java HotSpot(TM) Client VM (build 11.2-b01, mixed mode)F:\javaexp\JavaStudy\src>javac
用法:javac <选项> <源文件>
其中,可能的选项包括:
-g 生成所有调试信息
-g:none 不生成任何调试信息
-g:{lines,vars,source} 只生成某些调试信息
-nowarn 不生成任何警告
-verbose 输出有关编译器正在执行的操作的消息
-deprecation 输出使用已过时的 API 的源位置
-classpath <路径> 指定查找用户类文件和注释处理程序的位置
-cp <路径> 指定查找用户类文件和注释处理程序的位置
-sourcepath <路径> 指定查找输入源文件的位置
-bootclasspath <路径> 覆盖引导类文件的位置
-extdirs <目录> 覆盖安装的扩展目录的位置
-endorseddirs <目录> 覆盖签名的标准路径的位置
-proc:{none,only} 控制是否执行注释处理和/或编译。
-processor <class1>[,<class2>,<class3>...]要运行的注释处理程序的名称;绕过默认
的搜索进程
-processorpath <路径> 指定查找注释处理程序的位置
-d <目录> 指定存放生成的类文件的位置
-s <目录> 指定存放生成的源文件的位置
-implicit:{none,class} 指定是否为隐式引用文件生成类文件
-encoding <编码> 指定源文件使用的字符编码
-source <版本> 提供与指定版本的源兼容性
-target <版本> 生成特定 VM 版本的类文件
-version 版本信息
-help 输出标准选项的提要
-Akey[=value] 传递给注释处理程序的选项
-X 输出非标准选项的提要
-J<标志> 直接将 <标志> 传递给运行时系统F:\javaexp\JavaStudy\src>java
Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)where options include:
-client to select the "client" VM
-server to select the "server" VM
-hotspot is a synonym for the "client" VM [deprecated]
The default VM is client. -cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
A ; separated list of directories, JAR archives,
and ZIP archives to search for class files.
-D<name>=<value>
set a system property
-verbose[:class|gc|jni]
enable verbose output
-version print product version and exit
-version:<value>
require the specified version to run
-showversion print product version and continue
-jre-restrict-search | -jre-no-restrict-search
include/exclude user private JREs in the version search
-? -help print this help message
-X print help on non-standard options
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
enable assertions
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
disable assertions
-esa | -enablesystemassertions
enable system assertions
-dsa | -disablesystemassertions
disable system assertions
-agentlib:<libname>[=<options>]
load native agent library <libname>, e.g. -agentlib:hprof
see also, -agentlib:jdwp=help and -agentlib:hprof=help
-agentpath:<pathname>[=<options>]
load native agent library by full pathname
-javaagent:<jarpath>[=<options>]
load Java programming language agent, see java.lang.instrument -splash:<imagepath>
show splash screen with specified image
在netbeans6.5中能调试成功,返回a=13
b=20
c=37
x=30
y=123456
成功生成(总时间:5 秒) 系统变量如下(部分)
F:\javaexp\JavaStudy\src>set
CLASS_PATH=.;D:\javasdk\jdk\lib\;
JAVA_HOME=D:\javasdk\jdk\
MWCSym2Includes=D:\s60\Carbide.c++\x86Build\Symbian_Support\MSL\MSL_C\MSL_Common
\Include;D:\s60\Carbide.c++\x86Build\Symbian_Support\MSL\MSL_C\MSL_Win32\Include
;D:\s60\Carbide.c++\x86Build\Symbian_Support\MSL\MSL_C\MSL_X86;D:\s60\Carbide.c+
+\x86Build\Symbian_Support\MSL\MSL_C++\MSL_Common\Include;D:\s60\Carbide.c++\x86
Build\Symbian_Support\MSL\MSL_Extras\MSL_Common\Include;D:\s60\Carbide.c++\x86Bu
ild\Symbian_Support\MSL\MSL_Extras\MSL_Win32\Include;D:\s60\Carbide.c++\x86Build
\Symbian_Support\Win32-x86 Support\Headers\Win32 SDK
MWSym2Libraries=D:\s60\Carbide.c++\x86Build\Symbian_Support\Win32-x86 Support\Li
braries\Win32 SDK;D:\s60\Carbide.c++\x86Build\Symbian_Support\Runtime\Runtime_x8
6\Runtime_Win32\Libs
Path=D:\s60\Carbide.c++\x86Build\Symbian_Tools\Command_Line_Tools;D:\s60\CSL Arm
Toolchain\bin;C:\Program Files\Common Files\Symbian\Tools;D:\s60\perl\bin\;C:\P
rogram Files\PC Connectivity Solution\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS
\System32\Wbem;C:\Program Files\Common Files\Thunder Network\KanKan\Codecs;D:\ja
vasdk\jdk\bin;C:\Program Files\Common Files\Ulead Systems\MPEG;D:\BATCHE;C:\Prog
ram Files\ATI Technologies\ATI.ACE\Core-Static;D:\javasdk\bin
初学java,很多不懂,请高手指出错误,万分感谢
public class Integers {
public static void main(String args[])
{ int a=015;
int b=20;
int c=0x25;
short x=30;
long y=123456L;
System.out.println("a="+a);
System.out.println("b="+b);
System.out.println("c="+c);
System.out.println("x="+x);
System.out.println("y="+y);}
}用javac Integers.java 能编译,用java Integers 是出错,出错信息如下F:\javaexp\JavaStudy\src>java Integers.class
Exception in thread "main" java.lang.NoClassDefFoundError: Integers/class
Caused by: java.lang.ClassNotFoundException: Integers.class
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
Could not find the main class: Integers.class. Program will exit.
环境配置应该是正确的,cmd 下输入 "java -version" "javac" "java" 分别返回 F:\javaexp\JavaStudy\src>java -version
java version "1.6.0_12"
Java(TM) SE Runtime Environment (build 1.6.0_12-b04)
Java HotSpot(TM) Client VM (build 11.2-b01, mixed mode)F:\javaexp\JavaStudy\src>javac
用法:javac <选项> <源文件>
其中,可能的选项包括:
-g 生成所有调试信息
-g:none 不生成任何调试信息
-g:{lines,vars,source} 只生成某些调试信息
-nowarn 不生成任何警告
-verbose 输出有关编译器正在执行的操作的消息
-deprecation 输出使用已过时的 API 的源位置
-classpath <路径> 指定查找用户类文件和注释处理程序的位置
-cp <路径> 指定查找用户类文件和注释处理程序的位置
-sourcepath <路径> 指定查找输入源文件的位置
-bootclasspath <路径> 覆盖引导类文件的位置
-extdirs <目录> 覆盖安装的扩展目录的位置
-endorseddirs <目录> 覆盖签名的标准路径的位置
-proc:{none,only} 控制是否执行注释处理和/或编译。
-processor <class1>[,<class2>,<class3>...]要运行的注释处理程序的名称;绕过默认
的搜索进程
-processorpath <路径> 指定查找注释处理程序的位置
-d <目录> 指定存放生成的类文件的位置
-s <目录> 指定存放生成的源文件的位置
-implicit:{none,class} 指定是否为隐式引用文件生成类文件
-encoding <编码> 指定源文件使用的字符编码
-source <版本> 提供与指定版本的源兼容性
-target <版本> 生成特定 VM 版本的类文件
-version 版本信息
-help 输出标准选项的提要
-Akey[=value] 传递给注释处理程序的选项
-X 输出非标准选项的提要
-J<标志> 直接将 <标志> 传递给运行时系统F:\javaexp\JavaStudy\src>java
Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)where options include:
-client to select the "client" VM
-server to select the "server" VM
-hotspot is a synonym for the "client" VM [deprecated]
The default VM is client. -cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
A ; separated list of directories, JAR archives,
and ZIP archives to search for class files.
-D<name>=<value>
set a system property
-verbose[:class|gc|jni]
enable verbose output
-version print product version and exit
-version:<value>
require the specified version to run
-showversion print product version and continue
-jre-restrict-search | -jre-no-restrict-search
include/exclude user private JREs in the version search
-? -help print this help message
-X print help on non-standard options
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
enable assertions
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
disable assertions
-esa | -enablesystemassertions
enable system assertions
-dsa | -disablesystemassertions
disable system assertions
-agentlib:<libname>[=<options>]
load native agent library <libname>, e.g. -agentlib:hprof
see also, -agentlib:jdwp=help and -agentlib:hprof=help
-agentpath:<pathname>[=<options>]
load native agent library by full pathname
-javaagent:<jarpath>[=<options>]
load Java programming language agent, see java.lang.instrument -splash:<imagepath>
show splash screen with specified image
在netbeans6.5中能调试成功,返回a=13
b=20
c=37
x=30
y=123456
成功生成(总时间:5 秒) 系统变量如下(部分)
F:\javaexp\JavaStudy\src>set
CLASS_PATH=.;D:\javasdk\jdk\lib\;
JAVA_HOME=D:\javasdk\jdk\
MWCSym2Includes=D:\s60\Carbide.c++\x86Build\Symbian_Support\MSL\MSL_C\MSL_Common
\Include;D:\s60\Carbide.c++\x86Build\Symbian_Support\MSL\MSL_C\MSL_Win32\Include
;D:\s60\Carbide.c++\x86Build\Symbian_Support\MSL\MSL_C\MSL_X86;D:\s60\Carbide.c+
+\x86Build\Symbian_Support\MSL\MSL_C++\MSL_Common\Include;D:\s60\Carbide.c++\x86
Build\Symbian_Support\MSL\MSL_Extras\MSL_Common\Include;D:\s60\Carbide.c++\x86Bu
ild\Symbian_Support\MSL\MSL_Extras\MSL_Win32\Include;D:\s60\Carbide.c++\x86Build
\Symbian_Support\Win32-x86 Support\Headers\Win32 SDK
MWSym2Libraries=D:\s60\Carbide.c++\x86Build\Symbian_Support\Win32-x86 Support\Li
braries\Win32 SDK;D:\s60\Carbide.c++\x86Build\Symbian_Support\Runtime\Runtime_x8
6\Runtime_Win32\Libs
Path=D:\s60\Carbide.c++\x86Build\Symbian_Tools\Command_Line_Tools;D:\s60\CSL Arm
Toolchain\bin;C:\Program Files\Common Files\Symbian\Tools;D:\s60\perl\bin\;C:\P
rogram Files\PC Connectivity Solution\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS
\System32\Wbem;C:\Program Files\Common Files\Thunder Network\KanKan\Codecs;D:\ja
vasdk\jdk\bin;C:\Program Files\Common Files\Ulead Systems\MPEG;D:\BATCHE;C:\Prog
ram Files\ATI Technologies\ATI.ACE\Core-Static;D:\javasdk\bin
初学java,很多不懂,请高手指出错误,万分感谢
解决方案 »
- java jdbc连接数据如何接收反馈信息! 比如在不存在表插入数据!
- QQ机器人怎么实现的
- 请教 gridbaglayout布局
- JAVA连接microsoft sql 2000数据库 出现问题,请各位大虾帮忙,急急急!!!
- 求助各位大仙,java连接oracle数据库问题。
- 在Java中是不是不能有静态构造函数
- linux下java编程问题???
- 日他妈的老板老是要我们加班?
- 小应用程序中,鼠标的指针如何改变,this.setCursor(Cursor.HAND_CURSOR);提示我的类中没有setCursor
- 有关new File(URI uri)的问题,请各位指点一二!
- GUI设计,如何更改鼠标样式
- 在frame上添加事件,一定要把所有函数重载吗?
不加 .class 能运行