java编译错误 [英] java compilation error

查看:91
本文介绍了java编译错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

javac:找不到文件:MyFirstApp.java

用法:javac< options> < source files =/>

使用-help获取可能的选项列表

错误显示即使我将路径设置为c:\>用户变量以及命令提示符中的程序文​​件(x86)\ java'\\ _jdk1.7.0_11 \ bin.i不知道问题是什么

请帮帮我

javac: file not found: MyFirstApp.java
Usage: javac <options> <source files="" />
use -help for a list of possible options
error is showing even i set the path as c:\>Program Files (x86)\java\jdk1.7.0_11\bin in user variables as well as in command prompt.i dont know whats the problem
please help me out

推荐答案

您应该从文件夹M yFirstApp.java javac 命令>是。请参阅文档页面 [ ^ ]。





[更新]

我修复了你的代码中的两个错误。

You should invoke the javac command from the folder MyFirstApp.java is. See the example at the documentation page[^].


[Update]
I fixed two errors in your code.
  1. 您的课程应声明为 public
  2. args type是字符串(而不是 String s )。
  1. Your class should be declared public.
  2. args type is String (instead of Strings).





以下代码编译并执行正常:



The following code compiles and executes fine:

import java.io.*;

public class hai
{
public static void main(String args[])
{
System.out.println("hai ");
}
}



[/ Update]


JAVAHOME=c:\>Program Files (x86)\java\jdk1.7.0_11\bin
PATH=%PATH%;%JAVAHOME%
cd <directory where="" your="" java="" source="" is="" stored="">
javac MyFirstApp.java
java MyFirstApp
</directory>



或者获取Netbeans或eclipse的副本并从内部运行IDE。


Alternatively get a copy of Netbeans or eclipse and run from within the IDE.


这篇关于java编译错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆