我安装了J2SE 6.o版本。现在我遇到了一个让它正常工作的问题。在Windows 7上第一次设置JAVA时出现问题
> C:\java\jdk1.6.0_25\bin
这是bin文件的路径,我把它放在Path选项卡中。在环境设置中。
我必须采取什么措施才能从命令提示符运行.java
文件?
我是否也必须在类路径选项卡中添加一些内容?
让我解释我的问题:
如果我运行和编译叫Shirt.java
下面提到的文件,它工作正常。
public class Shirt{
public int ShirtID=0;
public String description="-description required-";
public char colorCode='U';
public double price=0.0;
public int quantityInStock=0;
public void displayShirtInformation(){
System.out.println("ShirtId:"+ShirtID);
System.out.println("ShirtDescription"+description);
System.out.println("Color Code:"+colorCode);
System.out.println("Shirt Price"+price);
System.out.println("Quantity In Stock"+quantityInStock);
}
}
但是,如果我运行另一个文件,调用以前的文件,然后出现问题。 调用前一个文件的文件如下所示。
public class ShirtTest {
public static void main (String args[]) {
Shirt myShirt = new Shirt();
myShirt.displayShirtInformation();
}
}
当我尝试执行第二个文件时,出现了一些错误,并且没有编译发生。我相信这与环境变量Path声明中的一些问题有关。
你说有错误,但你没有说过它们是什么。你说没有编译,但可能是编译错误。你说你正在尝试*执行*一个文件,但我怀疑你的意思是你正在尝试*编译*这个文件。您还没有告诉我们您是如何尝试编译的,或者其中的任何文件在哪里。请阅读http://tinyurl.com/so-hints –
请学习如何使用SO的代码格式化工具。要格式化一些代码(HTML,I/O等),请选择代码并单击发布表单上方的“{}”按钮。 –
顺便说一句 - 这个问题如何不同于你的[其他问题](http://stackoverflow.com/questions/6424458/error-while-calling-dependent-file)? –