Java Wrieless Toolkit

Java Wrieless Toolkit

MY application code does not work on the Java Wireless Toolkit-

import java.io.*;

public Write{

public static void main(String[] args) throws IOException{

BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

System.out.print("Please enter the file name to create : ");

String file_name = in.readLine();


File file = new File(file_name);

boolean exist = file.createNewFile();

if (!exist)

{
  System.out.println("File already exists.");

  System.exit(0);

}
else
{

  FileWriter fstream = new FileWriter(file_name);

  BufferedWriter out = new BufferedWriter(fstream);

  out.write(in.readLine());

  out.close();

  System.out.println("File created successfully.");
}

} } this indicates error :::::::->

Project "Numune7" loaded

Project settings saved

Building "Numune7"

C:\WTK23\apps\Numune7\src\Write.java:3: class or interface expected

public Write{

   ^

C:\WTK23\apps\Numune7\src\Write.java:5: class or interface expected

public static void main(String[] args) throws IOException{

            ^

C:\WTK23\apps\Numune7\src\Write.java:7: class or interface expected

System.out.print("Please enter the file name to create : ");

^

C:\WTK23\apps\Numune7\src\Write.java:8: class or interface expected

String file_name = in.readLine();
^

C:\WTK23\apps\Numune7\src\Write.java:9: class or interface expected

File file = new File(file_name);
^

C:\WTK23\apps\Numune7\src\Write.java:10: class or interface expected

boolean exist = file.createNewFile();
^

C:\WTK23\apps\Numune7\src\Write.java:11: class or interface expected

if (!exist)
^

C:\WTK23\apps\Numune7\src\Write.java:14: class or interface expected System.exit(0);

  ^

C:\WTK23\apps\Numune7\src\Write.java:15: class or interface expected

}
^

C:\WTK23\apps\Numune7\src\Write.java:19: class or interface expected

  BufferedWriter out = new BufferedWriter(fstream);

  ^

C:\WTK23\apps\Numune7\src\Write.java:20: class or interface expected

  out.write(in.readLine());
  ^

C:\WTK23\apps\Numune7\src\Write.java:21: class or interface expected out.close();

  ^

C:\WTK23\apps\Numune7\src\Write.java:22: class or interface expected

  System.out.println("File created successfully.");
  ^

C:\WTK23\apps\Numune7\src\Write.java:23: class or interface expected } ^ 14 errors com.sun.kvem.ktools.ExecutionException

Build failed Running with storage root DefaultColorPhone

Running with locale: Russian_Russia.1251

Unable to create MIDlet Write

java.lang.ClassNotFoundException: Write

at com.sun.midp.midlet.MIDletState.createMIDlet(+29)

at com.sun.midp.midlet.Selector.run(+22)

Execution completed.

918411 bytecodes executed

30 thread switches

893 classes in the system (including system classes)

4528 dynamic objects allocated (127500 bytes)

1 garbage collections (0 bytes collected)

View Answers

March 10, 2011 at 5:01 PM

Try this:

import java.io.*;
public  class Write{
public static void main(String[] args) throws IOException{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
System.out.print("Please enter the file name to create : ");
String file_name = in.readLine();
File file = new File(file_name);
boolean exist = file.createNewFile();
if (!exist){
  System.out.println("File already exists.");
  System.exit(0);
}
else{
  FileWriter fstream = new FileWriter(file_name);
  BufferedWriter out = new BufferedWriter(fstream);
  out.write(in.readLine());
  out.close();
  System.out.println("File created successfully.");
}
}
}

Thanks


March 11, 2011 at 1:14 AM

<p>Thank you very much, but it did not help me. I am writing software code in the Java Wireless toolbar 2.3 beta. For this purpose, the expansion of the java file open. After I added you provide the program code into the file . Put this file in src directory. I do not think I am correct in this series? what I wrong? .. This should be a help to me</p>

<p>Project settings saved</p>

<p>Building "India"</p>

<p>C:\WTK23\apps\India\src\Write.java:6: cannot resolve symbol
symbol  : class BufferedReader </p>

<p>location: class Write
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
^
C:\WTK23\apps\India\src\Write.java:6: cannot resolve symbol
symbol  : class BufferedReader 
location: class Write
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
                        ^
C:\WTK23\apps\India\src\Write.java:6: cannot resolve symbol
symbol  : variable in </p>

<p>location: class java.lang.System</p>

<p>BufferedReader in = new BufferedReader(new </p>

<p>InputStreamReader(System.in));
                                                                   ^
C:\WTK23\apps\India\src\Write.java:9: cannot resolve symbol
symbol  : class File 
location: class Write
File file = new File(file_name);
^
C:\WTK23\apps\India\src\Write.java:9: cannot resolve symbol
symbol  : class File </p>

<p>location: class Write</p>

<p>File file = new File(file_name);</p>

<pre class="prettyprint">            ^
</code></pre>

<p>C:\WTK23\apps\India\src\Write.java:16: cannot resolve symbol
symbol  : class FileWriter </p>

<p>location: class Write
  FileWriter fstream = new FileWriter(file_name);</p>

<p>  ^
C:\WTK23\apps\India\src\Write.java:16: cannot resolve symbol
symbol  : class FileWriter </p>

<p>location: class Write
  FileWriter fstream = new FileWriter(file_name);
                           ^
C:\WTK23\apps\India\src\Write.java:17: cannot resolve symbol
symbol  : class BufferedWriter 
location: class Write
  BufferedWriter out = new BufferedWriter(fstream);
  ^
C:\WTK23\apps\India\src\Write.java:17: cannot resolve symbol
symbol  : class BufferedWriter 
location: class Write</p>

<p>  BufferedWriter out = new BufferedWriter(fstream);
                           ^
9 errors
com.sun.kvem.ktools.ExecutionException
Build failed</p>

<p>Running with storage root DefaultColorPhone</p>

<p>Running with locale: Russian_Russia.1251</p>

<p>Unable to create MIDlet Write
java.lang.ClassNotFoundException: Write</p>

<pre class="prettyprint">at com.sun.midp.midlet.MIDletState.createMIDlet(+29)
at com.sun.midp.midlet.Selector.run(+22)
</code></pre>

<p>Execution completed.</p>

<p>917006 bytecodes executed</p>

<p>27 thread switches</p>

<p>893 classes in the system (including system classes)</p>

<p>4520 dynamic objects allocated (127232 bytes)</p>

<p>1 garbage collections (0 bytes collected)</p>









Related Tutorials/Questions & Answers:
Java Wrieless Toolkit
Java Wrieless Toolkit  MY application code does not work on the Java Wireless Toolkit- import java.io.*; public Write{ public static void main(String[] args) throws IOException{ BufferedReader in = new BufferedReader(new
java Toolkit
java Toolkit  how to set jframe form screen size any resolutions fit to full screen
Advertisements
Toolkit Class.......... - Java Beginners
Toolkit Class  Hi will you please tell me something about Toolkit class. What following code will give ToolKit kit=ToolKit.getDefaultToolKit(); Dimension dim=kit.getScreenSize(); & How JFileChosser is used Please
Version of com.onelogin>java-saml-toolkit dependency
List of Version of com.onelogin>java-saml-toolkit dependency
Sun Java Wireless Toolkit
Sun Java Wireless Toolkit       Java Platform, Micro Edition The Sun Java Wireless Toolkit is also known as Java Platform, Micro Edition (Java ME) Wireless Toolkit. Java
Maven Dependency java-saml-toolkit >> 2.0.0
You should include the dependency code given in this page to add Maven Dependency of com.onelogin >> java-saml-toolkit version2.0.0 in your project
Maven Dependency java-saml-toolkit >> 2.0.1
You should include the dependency code given in this page to add Maven Dependency of com.onelogin >> java-saml-toolkit version2.0.1 in your project
Maven Repository/Dependency: com.onelogin | java-saml-toolkit
Maven Repository/Dependency of Group ID com.onelogin and Artifact ID java-saml-toolkit. Latest version of com.onelogin:java-saml-toolkit dependencies. # Version Release Date 1
Maven dependency for com.airnauts - toolkit version 2.0.3 is released. Learn to use toolkit version 2.0.3 in Maven based Java projects
( com.airnauts - toolkit version 2.0.3 ) in their Java project if it is based...? Steps to use  com.airnauts - toolkit version 2.0.3 in Java projects... - toolkit version 2.0.3 java library in your project. ADS_TO_REPLACE_2 Now you can
Maven dependency for com.airnauts - toolkit version 1.4.3 is released. Learn to use toolkit version 1.4.3 in Maven based Java projects
( com.airnauts - toolkit version 1.4.3 ) in their Java project if it is based...? Steps to use  com.airnauts - toolkit version 1.4.3 in Java projects... - toolkit version 1.4.3 java library in your project. ADS_TO_REPLACE_2 Now you can
Maven dependency for com.airnauts - toolkit version 1.0.0 is released. Learn to use toolkit version 1.0.0 in Maven based Java projects
( com.airnauts - toolkit version 1.0.0 ) in their Java project if it is based...? Steps to use  com.airnauts - toolkit version 1.0.0 in Java projects... - toolkit version 1.0.0 java library in your project. ADS_TO_REPLACE_2 Now you can
Maven dependency for com.airnauts - toolkit version 2.0.0 is released. Learn to use toolkit version 2.0.0 in Maven based Java projects
( com.airnauts - toolkit version 2.0.0 ) in their Java project if it is based...? Steps to use  com.airnauts - toolkit version 2.0.0 in Java projects... - toolkit version 2.0.0 java library in your project. ADS_TO_REPLACE_2 Now you can
Maven dependency for com.airnauts - toolkit version 1.1.0 is released. Learn to use toolkit version 1.1.0 in Maven based Java projects
( com.airnauts - toolkit version 1.1.0 ) in their Java project if it is based...? Steps to use  com.airnauts - toolkit version 1.1.0 in Java projects... - toolkit version 1.1.0 java library in your project. ADS_TO_REPLACE_2 Now you can
Maven dependency for com.airnauts - toolkit version 2.0.2 is released. Learn to use toolkit version 2.0.2 in Maven based Java projects
( com.airnauts - toolkit version 2.0.2 ) in their Java project if it is based...? Steps to use  com.airnauts - toolkit version 2.0.2 in Java projects... - toolkit version 2.0.2 java library in your project. ADS_TO_REPLACE_2 Now you can
Maven dependency for com.airnauts - toolkit version 2.0.1 is released. Learn to use toolkit version 2.0.1 in Maven based Java projects
( com.airnauts - toolkit version 2.0.1 ) in their Java project if it is based...? Steps to use  com.airnauts - toolkit version 2.0.1 in Java projects... - toolkit version 2.0.1 java library in your project. ADS_TO_REPLACE_2 Now you can
Maven dependency for com.airnauts - toolkit version 1.2.0 is released. Learn to use toolkit version 1.2.0 in Maven based Java projects
( com.airnauts - toolkit version 1.2.0 ) in their Java project if it is based...? Steps to use  com.airnauts - toolkit version 1.2.0 in Java projects... - toolkit version 1.2.0 java library in your project. ADS_TO_REPLACE_2 Now you can
Maven dependency for com.airnauts - toolkit version 1.1.1 is released. Learn to use toolkit version 1.1.1 in Maven based Java projects
( com.airnauts - toolkit version 1.1.1 ) in their Java project if it is based...? Steps to use  com.airnauts - toolkit version 1.1.1 in Java projects... - toolkit version 1.1.1 java library in your project. ADS_TO_REPLACE_2 Now you can
IT Mill Toolkit
IT Mill Toolkit       IT Mill Toolkit 5 is a server-side RIA framework that provides Java programmers with complete set of RIA widgets. Applications are programmed (with Java
Maven dependency for fr.ird.observe - toolkit-navigation version 5.0.63 is released. Learn to use toolkit-navigation version 5.0.63 in Maven based Java projects
to use  fr.ird.observe - toolkit-navigation version 5.0.63 in Java projects...Maven dependency for  fr.ird.observe  - Version 5.0.63 of toolkit-navigation released The developers of   fr.ird.observe - toolkit
Maven dependency for fr.ird.observe - toolkit-navigation version 5.0.62 is released. Learn to use toolkit-navigation version 5.0.62 in Maven based Java projects
to use  fr.ird.observe - toolkit-navigation version 5.0.62 in Java projects...Maven dependency for  fr.ird.observe  - Version 5.0.62 of toolkit-navigation released The developers of   fr.ird.observe - toolkit
Maven dependency for fr.ird.observe - toolkit-navigation version 5.0.61 is released. Learn to use toolkit-navigation version 5.0.61 in Maven based Java projects
to use  fr.ird.observe - toolkit-navigation version 5.0.61 in Java projects...Maven dependency for  fr.ird.observe  - Version 5.0.61 of toolkit-navigation released The developers of   fr.ird.observe - toolkit
Maven dependency for fr.ird.observe - toolkit-navigation version 5.0.60 is released. Learn to use toolkit-navigation version 5.0.60 in Maven based Java projects
to use  fr.ird.observe - toolkit-navigation version 5.0.60 in Java projects...Maven dependency for  fr.ird.observe  - Version 5.0.60 of toolkit-navigation released The developers of   fr.ird.observe - toolkit
Maven dependency for fr.ird.observe - toolkit-navigation version 5.0.59 is released. Learn to use toolkit-navigation version 5.0.59 in Maven based Java projects
to use  fr.ird.observe - toolkit-navigation version 5.0.59 in Java projects...Maven dependency for  fr.ird.observe  - Version 5.0.59 of toolkit-navigation released The developers of   fr.ird.observe - toolkit
Maven dependency for fr.ird.observe - toolkit-navigation version 5.0.58 is released. Learn to use toolkit-navigation version 5.0.58 in Maven based Java projects
to use  fr.ird.observe - toolkit-navigation version 5.0.58 in Java projects...Maven dependency for  fr.ird.observe  - Version 5.0.58 of toolkit-navigation released The developers of   fr.ird.observe - toolkit
Maven dependency for fr.ird.observe - toolkit-navigation version 5.0.57 is released. Learn to use toolkit-navigation version 5.0.57 in Maven based Java projects
to use  fr.ird.observe - toolkit-navigation version 5.0.57 in Java projects...Maven dependency for  fr.ird.observe  - Version 5.0.57 of toolkit-navigation released The developers of   fr.ird.observe - toolkit
Maven dependency for fr.ird.observe - toolkit-navigation version 5.0.56 is released. Learn to use toolkit-navigation version 5.0.56 in Maven based Java projects
to use  fr.ird.observe - toolkit-navigation version 5.0.56 in Java projects...Maven dependency for  fr.ird.observe  - Version 5.0.56 of toolkit-navigation released The developers of   fr.ird.observe - toolkit
Maven dependency for fr.ird.observe - toolkit-navigation version 5.0.55 is released. Learn to use toolkit-navigation version 5.0.55 in Maven based Java projects
to use  fr.ird.observe - toolkit-navigation version 5.0.55 in Java projects...Maven dependency for  fr.ird.observe  - Version 5.0.55 of toolkit-navigation released The developers of   fr.ird.observe - toolkit
Maven dependency for fr.ird.observe - toolkit-navigation version 5.0.54 is released. Learn to use toolkit-navigation version 5.0.54 in Maven based Java projects
to use  fr.ird.observe - toolkit-navigation version 5.0.54 in Java projects...Maven dependency for  fr.ird.observe  - Version 5.0.54 of toolkit-navigation released The developers of   fr.ird.observe - toolkit
Maven dependency for fr.ird.observe - toolkit-navigation version 5.0.53 is released. Learn to use toolkit-navigation version 5.0.53 in Maven based Java projects
to use  fr.ird.observe - toolkit-navigation version 5.0.53 in Java projects...Maven dependency for  fr.ird.observe  - Version 5.0.53 of toolkit-navigation released The developers of   fr.ird.observe - toolkit
Maven dependency for fr.ird.observe - toolkit-navigation version 5.0.52 is released. Learn to use toolkit-navigation version 5.0.52 in Maven based Java projects
to use  fr.ird.observe - toolkit-navigation version 5.0.52 in Java projects...Maven dependency for  fr.ird.observe  - Version 5.0.52 of toolkit-navigation released The developers of   fr.ird.observe - toolkit
Maven dependency for fr.ird.observe - toolkit-navigation version 5.0.51 is released. Learn to use toolkit-navigation version 5.0.51 in Maven based Java projects
to use  fr.ird.observe - toolkit-navigation version 5.0.51 in Java projects...Maven dependency for  fr.ird.observe  - Version 5.0.51 of toolkit-navigation released The developers of   fr.ird.observe - toolkit
Maven dependency for fr.ird.observe - toolkit-navigation version 5.0.50 is released. Learn to use toolkit-navigation version 5.0.50 in Maven based Java projects
to use  fr.ird.observe - toolkit-navigation version 5.0.50 in Java projects...Maven dependency for  fr.ird.observe  - Version 5.0.50 of toolkit-navigation released The developers of   fr.ird.observe - toolkit
Maven dependency for fr.ird.observe - toolkit-navigation version 5.0.49 is released. Learn to use toolkit-navigation version 5.0.49 in Maven based Java projects
to use  fr.ird.observe - toolkit-navigation version 5.0.49 in Java projects...Maven dependency for  fr.ird.observe  - Version 5.0.49 of toolkit-navigation released The developers of   fr.ird.observe - toolkit
Maven dependency for fr.ird.observe - toolkit-navigation version 5.0.48 is released. Learn to use toolkit-navigation version 5.0.48 in Maven based Java projects
to use  fr.ird.observe - toolkit-navigation version 5.0.48 in Java projects...Maven dependency for  fr.ird.observe  - Version 5.0.48 of toolkit-navigation released The developers of   fr.ird.observe - toolkit
Maven dependency for fr.ird.observe - toolkit-navigation version 5.0.47 is released. Learn to use toolkit-navigation version 5.0.47 in Maven based Java projects
to use  fr.ird.observe - toolkit-navigation version 5.0.47 in Java projects...Maven dependency for  fr.ird.observe  - Version 5.0.47 of toolkit-navigation released The developers of   fr.ird.observe - toolkit
Maven dependency for fr.ird.observe - toolkit-navigation version 5.0.46 is released. Learn to use toolkit-navigation version 5.0.46 in Maven based Java projects
to use  fr.ird.observe - toolkit-navigation version 5.0.46 in Java projects...Maven dependency for  fr.ird.observe  - Version 5.0.46 of toolkit-navigation released The developers of   fr.ird.observe - toolkit
Maven dependency for fr.ird.observe - toolkit-navigation version 5.0.45 is released. Learn to use toolkit-navigation version 5.0.45 in Maven based Java projects
to use  fr.ird.observe - toolkit-navigation version 5.0.45 in Java projects...Maven dependency for  fr.ird.observe  - Version 5.0.45 of toolkit-navigation released The developers of   fr.ird.observe - toolkit
Maven dependency for fr.ird.observe - toolkit-navigation version 5.0.44 is released. Learn to use toolkit-navigation version 5.0.44 in Maven based Java projects
to use  fr.ird.observe - toolkit-navigation version 5.0.44 in Java projects...Maven dependency for  fr.ird.observe  - Version 5.0.44 of toolkit-navigation released The developers of   fr.ird.observe - toolkit
Maven dependency for fr.ird.observe - toolkit-navigation version 5.0.43 is released. Learn to use toolkit-navigation version 5.0.43 in Maven based Java projects
to use  fr.ird.observe - toolkit-navigation version 5.0.43 in Java projects...Maven dependency for  fr.ird.observe  - Version 5.0.43 of toolkit-navigation released The developers of   fr.ird.observe - toolkit
Maven dependency for fr.ird.observe - toolkit-navigation version 5.0.42 is released. Learn to use toolkit-navigation version 5.0.42 in Maven based Java projects
to use  fr.ird.observe - toolkit-navigation version 5.0.42 in Java projects...Maven dependency for  fr.ird.observe  - Version 5.0.42 of toolkit-navigation released The developers of   fr.ird.observe - toolkit
Maven dependency for fr.ird.observe - toolkit-navigation version 5.0.41 is released. Learn to use toolkit-navigation version 5.0.41 in Maven based Java projects
to use  fr.ird.observe - toolkit-navigation version 5.0.41 in Java projects...Maven dependency for  fr.ird.observe  - Version 5.0.41 of toolkit-navigation released The developers of   fr.ird.observe - toolkit
Maven dependency for fr.ird.observe - toolkit-navigation version 5.0.40 is released. Learn to use toolkit-navigation version 5.0.40 in Maven based Java projects
to use  fr.ird.observe - toolkit-navigation version 5.0.40 in Java projects...Maven dependency for  fr.ird.observe  - Version 5.0.40 of toolkit-navigation released The developers of   fr.ird.observe - toolkit
Maven dependency for fr.ird.observe - toolkit-navigation version 5.0.39 is released. Learn to use toolkit-navigation version 5.0.39 in Maven based Java projects
to use  fr.ird.observe - toolkit-navigation version 5.0.39 in Java projects...Maven dependency for  fr.ird.observe  - Version 5.0.39 of toolkit-navigation released The developers of   fr.ird.observe - toolkit
Maven dependency for fr.ird.observe - toolkit-navigation version 5.0.38 is released. Learn to use toolkit-navigation version 5.0.38 in Maven based Java projects
to use  fr.ird.observe - toolkit-navigation version 5.0.38 in Java projects...Maven dependency for  fr.ird.observe  - Version 5.0.38 of toolkit-navigation released The developers of   fr.ird.observe - toolkit
Maven dependency for fr.ird.observe - toolkit-navigation version 5.0.37 is released. Learn to use toolkit-navigation version 5.0.37 in Maven based Java projects
to use  fr.ird.observe - toolkit-navigation version 5.0.37 in Java projects...Maven dependency for  fr.ird.observe  - Version 5.0.37 of toolkit-navigation released The developers of   fr.ird.observe - toolkit
Maven dependency for fr.ird.observe - toolkit-navigation version 5.0.36 is released. Learn to use toolkit-navigation version 5.0.36 in Maven based Java projects
to use  fr.ird.observe - toolkit-navigation version 5.0.36 in Java projects...Maven dependency for  fr.ird.observe  - Version 5.0.36 of toolkit-navigation released The developers of   fr.ird.observe - toolkit
Maven dependency for fr.ird.observe - toolkit-navigation version 5.0.35 is released. Learn to use toolkit-navigation version 5.0.35 in Maven based Java projects
to use  fr.ird.observe - toolkit-navigation version 5.0.35 in Java projects...Maven dependency for  fr.ird.observe  - Version 5.0.35 of toolkit-navigation released The developers of   fr.ird.observe - toolkit
Maven dependency for fr.ird.observe - toolkit-navigation version 5.0.34 is released. Learn to use toolkit-navigation version 5.0.34 in Maven based Java projects
to use  fr.ird.observe - toolkit-navigation version 5.0.34 in Java projects...Maven dependency for  fr.ird.observe  - Version 5.0.34 of toolkit-navigation released The developers of   fr.ird.observe - toolkit
Maven dependency for fr.ird.observe - toolkit-navigation version 5.0.33 is released. Learn to use toolkit-navigation version 5.0.33 in Maven based Java projects
to use  fr.ird.observe - toolkit-navigation version 5.0.33 in Java projects...Maven dependency for  fr.ird.observe  - Version 5.0.33 of toolkit-navigation released The developers of   fr.ird.observe - toolkit
Maven dependency for fr.ird.observe - toolkit-navigation version 5.0.32 is released. Learn to use toolkit-navigation version 5.0.32 in Maven based Java projects
to use  fr.ird.observe - toolkit-navigation version 5.0.32 in Java projects...Maven dependency for  fr.ird.observe  - Version 5.0.32 of toolkit-navigation released The developers of   fr.ird.observe - toolkit

Ads