当前位置: 技术问答>java相关
怎样调用自己编写的java类?
来源: 互联网 发布时间:2015-02-21
本文导语: 比如我自己的jdk安装在C:jdk1.3下,而我编写的java类在D:corejava下面! | 把你写的类用包装好,然后设置classpath,在你写的程序开始import你要用的那个类,java编译器会找到的,谢谢。 | ...
比如我自己的jdk安装在C:jdk1.3下,而我编写的java类在D:corejava下面!
|
把你写的类用包装好,然后设置classpath,在你写的程序开始import你要用的那个类,java编译器会找到的,谢谢。
|
java -classpath d:corejava YourClass
欢迎光临Java,J2EE论坛( http://letsjava.yeah.net )。
http://www.minij2ee.com/
欢迎光临Java,J2EE论坛( http://letsjava.yeah.net )。
http://www.minij2ee.com/
|
At first, confirm your jdk setting is allright.
If your OS is Win, add line "SET PATH=d:corejava;%PATH%" in the bottom of file "autoexec.bat"; and then reboot you machine to guarantee that you can run it normally in your every Dos window.
if your OS is Linux, add line "EXPORT CLASSPATH=$CLASSPATH:YOUR DIRECTORY" in the bottom of file "profile" in directory "/etc/"
Good luck!
If your OS is Win, add line "SET PATH=d:corejava;%PATH%" in the bottom of file "autoexec.bat"; and then reboot you machine to guarantee that you can run it normally in your every Dos window.
if your OS is Linux, add line "EXPORT CLASSPATH=$CLASSPATH:YOUR DIRECTORY" in the bottom of file "profile" in directory "/etc/"
Good luck!