Click here to Skip to main content
15,921,203 members
Home / Discussions / Java
   

Java

 
GeneralRe: How to determine given file is a class file? Pin
glitteringsound13-Jul-10 21:12
glitteringsound13-Jul-10 21:12 
GeneralRe: How to determine given file is a class file? Pin
Cedric Moonen13-Jul-10 21:19
Cedric Moonen13-Jul-10 21:19 
GeneralRe: How to determine given file is a class file? Pin
Upendra Jariya28-Jul-10 4:30
Upendra Jariya28-Jul-10 4:30 
AnswerRe: How to determine given file is a class file? Pin
Richard MacCutchan13-Jul-10 22:15
mveRichard MacCutchan13-Jul-10 22:15 
QuestionHow to install java Automatically if not present on Machine? Pin
002comp13-Jul-10 20:35
002comp13-Jul-10 20:35 
AnswerRe: How to install java Automatically if not present on Machine?I got some Info.See if guys can Help me out now. Pin
002comp15-Jul-10 2:24
002comp15-Jul-10 2:24 
GeneralRe: How to install java Automatically if not present on Machine?I got some Info.See if guys can Help me out now. Pin
Ravi Sant19-Apr-11 3:55
Ravi Sant19-Apr-11 3:55 
QuestionWriting A file to server Pin
002comp12-Jul-10 19:00
002comp12-Jul-10 19:00 
Hello Guys
i am trying to write a file to server with URLConnection.And here is the code below.I created one file at that location and with my code trying to write some thing but nothing is happening.I need some ideas.Or is it some issue with access to server on that file?

Code:
try {

    URL                url; 
    URLConnection      urlConn; 
    DataOutputStream   dos; 
    DataInputStream    dis;

    url = new URL("http://sample.com/test/file.txt"); 
    urlConn = url.openConnection(); 
    urlConn.setDoInput(true); 
    urlConn.setDoOutput(true); 
    urlConn.setUseCaches(false); 

    dos = new DataOutputStream (urlConn.getOutputStream()); 
    String message = "Yahoooooooo";
    dos.writeBytes(message); 
    dos.flush(); 
    dos.close();

    // the server responds by saying 
    // "SUCCESS" or "FAILURE"

    dis = new DataInputStream(urlConn.getInputStream()); 
    String s = dis.readLine(); 

//s is coming null.
    dis.close(); 


  
  } // end of "try"

  catch (MalformedURLException mue) { 
    addTextField.setText("mue error"); 
  } 
  catch (IOException ioe) { 
    addTextField.setText("IO Exception"); 
  }


Any Ideas guys.
Thanks & Regards
Yogesh
AnswerRe: Writing A file to server Pin
Gerben Jongerius13-Jul-10 2:04
Gerben Jongerius13-Jul-10 2:04 
GeneralRe: Writing A file to server Pin
002comp13-Jul-10 2:54
002comp13-Jul-10 2:54 
AnswerRe: Writing A file to server Pin
Gerben Jongerius13-Jul-10 3:04
Gerben Jongerius13-Jul-10 3:04 
GeneralRe: Writing A file to server Pin
002comp13-Jul-10 19:47
002comp13-Jul-10 19:47 
QuestionProgressbar while some process is running Pin
002comp8-Jul-10 23:30
002comp8-Jul-10 23:30 
AnswerRe: Progressbar while some process is running Pin
David Skelly9-Jul-10 2:13
David Skelly9-Jul-10 2:13 
GeneralRe: Progressbar while some process is running Pin
002comp9-Jul-10 2:35
002comp9-Jul-10 2:35 
QuestionFile Object with URL? Pin
002comp5-Jul-10 23:37
002comp5-Jul-10 23:37 
AnswerRe: File Object with URL? Pin
Richard MacCutchan6-Jul-10 1:47
mveRichard MacCutchan6-Jul-10 1:47 
GeneralRe: File Object with URL? Pin
002comp6-Jul-10 19:57
002comp6-Jul-10 19:57 
GeneralRe: File Object with URL? Pin
Richard MacCutchan6-Jul-10 21:19
mveRichard MacCutchan6-Jul-10 21:19 
QuestionSingleton and TCP server Pin
Nadunwow2-Jul-10 7:07
Nadunwow2-Jul-10 7:07 
AnswerRe: Singleton and TCP server Pin
Richard MacCutchan2-Jul-10 8:37
mveRichard MacCutchan2-Jul-10 8:37 
GeneralRe: Singleton and TCP server Pin
Nadunwow2-Jul-10 8:41
Nadunwow2-Jul-10 8:41 
GeneralRe: Singleton and TCP server Pin
Richard MacCutchan2-Jul-10 8:57
mveRichard MacCutchan2-Jul-10 8:57 
GeneralRe: Singleton and TCP server Pin
Nagy Vilmos6-Jul-10 3:53
professionalNagy Vilmos6-Jul-10 3:53 
GeneralRe: Singleton and TCP server Pin
Nagy Vilmos6-Jul-10 3:55
professionalNagy Vilmos6-Jul-10 3:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.