Question about Computers & Internet

Open Question

FileConnection error in j2me

I m getting problem
this is j2me program
i m getting this error while exe.
"java.lang.IllegalArgumentException: Root is not accessible"


the program is:
i m getting error in the first line of function "startConn()"


import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import java.io.*;
import javax.microedition.io.*;
import javax.microedition.io.file.FileConnection;
import javax.microedition.pim.*;


public class FileC extends MIDlet implements CommandListener
{
private Command exit, start;
private Display display;
private Form form;

public FileC ()
{
display = Display.getDisplay(this);
exit = new Command("Exit", Command.EXIT, 1);
start = new Command("Start", Command.EXIT, 1);
form = new Form("Write To File");
form.addCommand(exit);
form.addCommand(start);
form.setCommandListener(this);
}

public void startApp() <------------------ error
{
display.setCurrent(form);
System.out.println("File1111111111111");
startConn();
}

public void pauseApp()
{
}
public void destroyApp(boolean unconditional)
{
}

public void commandAction(Command c,Displayable d)
{
if(c==exit)
{
destroyApp(false);
notifyDestroyed();
}

}
public void startConn()
{
try
{


FileConnection connection = (FileConnection)Connector.open("file:///C:/myfile.txt" );
InputStream out = connection.openInputStream();
System.out.println(out);
InputStreamReader output = new InputStreamReader( out );
out.println(output );
//output.flush();
out.close();
connection.close();
Alert a=new Alert("hello","I m fine",null,null);
a.setTimeout(5000);
display.setCurrent(a);
}
catch(Exception e)
{
System.out.println("Hello "+e);
}
}
}






HEPL ME

Posted by on

  • vrusha_App Jan 16, 2009

    Hi,
    I have same problem I have written same code, only difference is I used following code fir connection.
    FileConnection fc = (FileConnection)
    Connector.open("file:///CFCard/");



×

5 Suggested Answers

SOURCE: c++

good

Posted on Feb 23, 2008


SOURCE: AWT PROBLEM IN JAVA.

its runing the program.it didnt has any problem

Posted on Aug 12, 2008

  • 2 Answers

SOURCE: please explain the working of this code

It's a Java http server (webserver) that serves random "prices" if they match a search string.

Well here is an explaination:

private static String[] symbols = {"DELL", "INTC", "MSFT", "ORCL", "SUNW"};
These are search strings

private static Random rnd = new Random();
This generates a random number

private static Charset cs = Charset.forName("UTF-8");
This is the charset that the http server uses

ServerSocketChannel server = ServerSocketChannel.open();
Create a new server

server.socket().bind(new InetSocketAddress(8055));
Bind the http server to port 8055

The rest is handling the request and processing it

But here:
if(Arrays.binarySearch(symbols, symbol) >= 0)
response = "Price is " + (1000 + rnd.nextInt(9000)) / 100.0;
else
response = "Price not available";
channel.write(cs.encode("HTTP/1.0 200 OK "));
channel.write(cs.encode("Content-type: text/plain "));
channel.write(cs.encode(response));
channel.close();
}
It sees if the string input matchs: DELL INTC MSFT ORCL SUNW.

(private static String[] symbols = {"DELL", "INTC", "MSFT", "ORCL", "SUNW"};)
If so, it gives a price based on a random number.
(
response = "Price is " + (1000 + rnd.nextInt(9000)) / 100.0;)
Or else
It says "price not available"
then it gives a html header to end the error message.

Hope I helped you :)
Gook luck

Posted on Nov 26, 2008

wesleyisaiah
  • 32 Answers

SOURCE: I am an MCA student.To read the file from PC to handheld device

you might need to run a anti-virus through your computer. it might have a bug. :) hope this helps!!

Posted on May 20, 2009

  • 323 Answers

SOURCE: jnlp code for the java program

From command prompt: You can also launch an application from a command prompt by typing javaws jnlp_url where jnlp_url is a url to the jnlp file of the application. Go to Start > Run > type "cmd". A command prompt window will appear. Type "javaws url_of_jnlp"

Posted on Jun 12, 2009

Add Your Answer

Uploading: 0%

my-video-file.mp4

Complete. Click "Add" to insert your video. Add

×

Loading...
Loading...

Related Questions:

2 Answers

What does 'Unknown Server Error 500' mean?


This is caused by incorrect MIME handling by Windows when 'DBF Viewer 2000' is installed. The 'DBF Viewer 2000' program associates the .DBF file extension with 'application/DBF Viewer 2000' instead of 'application/octet-stream'. Remove 'DBF Viewer 2000' from the affected system. If you are still experiencing the issue I can suggest this program DBF Repair Toolbox https://www.repairtoolbox.com/dbfrepair.html

Mar 31, 2016 | Computers & Internet

1 Answer

How do i fix javaw.exe error


Go into control panel, program's, uninstall a program.
Find java in the list and uninstall it.
Then go to www.java.com and follow the instructions to install the latest version of Java.

Jul 29, 2014 | Video Game Consoles & Games

1 Answer

What is a java j2me device and what does it do ?


Hi .. Java has two version Jre and j2me. So mobile which has Java loaded /enabled will be able run the application made on java. So the games and applications who have the extensions .jar will be able to run only mobile efficiently.

Regards
Vipin Kakkar

Jan 31, 2011 | Samsung Cell Phones

1 Answer

What is J2ME?


J2ME
Java Platform, Micro Edition (Java ME) provides a robust, flexible environment for applications running on mobile and other embedded devices—mobile phones, personal digital assistants (PDAs), TV set-top boxes, and printers. Java ME includes flexible user interfaces, robust security, built-in network protocols, and support for networked and offline applications that can be downloaded dynamically. Applications based on Java ME are portable across many devices, yet leverage each device's native capabilities.

Java Security
Java security technology includes a large set of APIs, tools, and implementations of commonly used security algorithms, mechanisms, and protocols. The Java security APIs span a wide range of areas, including cryptography, public key infrastructure, secure communication, authentication, and access control. Java security technology provides the developer with a comprehensive security framework for writing applications, and also provides the user or administrator with a set of tools to securely manage applications.

Jul 17, 2010 | Sun Java Studio Standard 5 (SSJI9501TL9M)...

4 Answers

I WANNA MAKE SOFTWARE OF MOBILES


it should be done by some tool box like ufs,infinity

Dec 03, 2008 | Nokia N72 Cellular Phone

1 Answer

Java and zylom games


This sounds like it could be a case where a simple error in the game is allowed to have enormous consequences. Rather than disconnecting your Internet connection, it may suffice to terminate the java process as follows:
  • Right-click the task bar. Click Task Manager.
  • In the Processes tab of the Task Manager, find java.exe (it might help to click on "Image Name" to have it sort alphabetically)
  • Select the line with the image name of java.exe and click the "End Process" button in the lower right corner of the window.

Have you tried running these games in a different browser? I recommend Mozilla Firefox or Google Chrome. Both are more robust than AOL Explorer, and Google Chrome in particular is designed so that an error in one tab won't cause any problems beyond that.

Please let me know if this helped. If it didn't, feel free to provide more details.

Sep 30, 2008 | Sun Java Programming Language (cdj-275)

3 Answers

Full form of .sis,.jar,.jad,and j2me


SIS is an acronym that stands for Symbian Installation Source
JAR file (or Java ARchive) is used for aggregating many files into one

Joint Application Development (JAD) is a popular fact-finding technique that brings users into the development process as active participants

J2ME stands for Java 2 Platform, Micro Edition

Jul 01, 2008 | Nokia 6300 Cellular Phone

2 Answers

Java.lang.NullPointerException


I believe the error should read "java.lang.NullPointerException"

This error simply means that whatever your application code is trying to get is not there- its a null. Its either out of range or does not exist at all.

Jun 03, 2008 | Sun Java Programming Language (cdj-275)

Not finding what you are looking for?
Computers & Internet Logo

Related Topics:

283 people viewed this question

Ask a Question

Usually answered in minutes!

Top Computers & Internet Experts

Brian Sullivan
Brian Sullivan

Level 3 Expert

27725 Answers

kakima

Level 3 Expert

100243 Answers

David Payne
David Payne

Level 3 Expert

14160 Answers

Are you a Computer and Internet Expert? Answer questions, earn points and help others

Answer questions

Manuals & User Guides

Loading...