Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Java
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 16-Apr-13 22:17pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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:
import java.io.*;
 
public class hai
{
public static void main(String args[])
{
System.out.println("hai ");
}
}
[/Update]
  Permalink  
v2
Comments
Member 9902987 at 17-Apr-13 3:28am
   
how to invoke javac from MyFirstApp.java sir.can you please give in detail
CPallini at 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 at 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 at 17-Apr-13 4:45am
   
thanq sir
CPallini at 17-Apr-13 5:29am
   
You are welcome.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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.
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 8,284
1 Sergey Alexandrovich Kryukov 7,407
2 DamithSL 5,614
3 Maciej Los 4,989
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web03 | 2.8.1411023.1 | Last Updated 17 Apr 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100