By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,960 Members | 990 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,960 IT Pros & Developers. It's quick & easy.

J2ME: Invalid file using Connection.open()

P: n/a
I get an "Invalid file" in my MIDlet when I tried to read a .txt file,
using Connection.open(). My phone is a Nokia 3595 with mMode
technology by AT&T. Here is my source code in my MIDlet:

try
{
// Open File text file
String filename = "http://www.someurl.com/File.txt";
HttpConnection connection =
(HttpConnection)Connector.open(filename);
InputStream inputStream = connection.openInputStream();
connection.close(); // doesn't close input stream!
} catch (){
ex.printStackTrace();
}

It fails when I trying any combination of Connector.open(filename). I
can connect to my server, because that is how I download app. I also,
have txt mime types defined as plain/text. Using the J2ME emulator my
code works.

What to do?
Jul 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.