Click here to Skip to main content
15,886,858 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
javac: file not found: MyFirstApp.java
Usage: javac <options>
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
Posted

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. Your class should be declared public.
  2. args type is String (instead of Strings).


The following code compiles and executes fine:
Java
import java.io.*;

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

[/Update]
 
Share this answer
 
v2
Comments
Member 9902987 17-Apr-13 3:28am    
how to invoke javac from MyFirstApp.java sir.can you please give in detail
CPallini 17-Apr-13 3:34am    
You shouldn't invoke javac from MyFirstApp.java. Instead you should invoke javac from MyFirstApp.java folder: If MyFirstApp.java is in "C:\Documents\MyPrograms" then you should issue:
cd C:\Documents\MyPrograms
javac MyFirstApp.java
Member 9902987 17-Apr-13 3:52am    
import java.io.*;
class hai
{
public static void main(Strings args[])
{
System.out.println("hai ");
}
}
showing error as
public static void main(String args[])
symbol:Strings
location:class hai
while running
Member 9902987 17-Apr-13 4:45am    
thanq sir
CPallini 17-Apr-13 5:29am    
You are welcome.
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>

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

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900