Click here to Skip to main content
16,017,015 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Java
import java.io.*;
import java.util.Properties;

public class Input
{
    // This code is nasty and not exception safe. Just demo code!
    public static void main(String[] args) throws Exception
    {    
    InputStream  stream = Input.class.getResourceAsStream("SomeTextFile.txt");
     InputStreamReader is=new InputStreamReader(stream);
     BufferedReader br =new BufferedReader(is);
     String str=null;
     while ((str = br.readLine()) != null) {
    	   System.out.println(str);
    	  }
		
               
    }
}

Hi,this is my class and my file name is "SomeTextFile.txt" which is located in C:\MyProgram,and the Input.class file is located in D:\myjava ,I want to run this program in commandprompt,like

D:\myjava>javac Input.java -then it will compile

D:\myjava>java Input -then it will showing error
also i give java -classpath C:\MyProgram Input and run also same error.
I am new in java ,please someone help me what i have to give in commandprompt?
Posted
Updated 2-Dec-12 21:19pm
v2

1 solution

Please use a decent IDE like Eclipse or Netbeans. Both are free, both work fine and both will do the compiling for you.
 
Share this answer
 
Comments
chinta123 3-Dec-12 3:54am    
ya,,i know but i want to run in commandprompt ...
TorstenH. 3-Dec-12 5:36am    
Command Reference for javac
have fun. If you want to develop and not just play - please use above mentioned programs. They are there for a reason.

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