Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners Java Wrieless Toolkit

Have Programming Question? Ask it here!
 
 
 


aygun
Java Wrieless Toolkit
2 Answer(s)      3 years and 6 months ago
Posted in : Java Beginners


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)


Advertisement
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
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
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
Plex Toolkit
Plex Toolkit       The Plex Toolkit is a collection of JavaScript libraries which handle the transformation of custom XML markup embedded in an HTML document into user interface
What is the best in Ajax Toolkit?
What is the best in Ajax Toolkit?  What is the best in Ajax Toolkit? Is not Ajax toolkit similar to the Ajax control toolkit? Can you expand it? (Sr, I am not good at English
Google Web Toolkit
Google Web Toolkit       Google Web Toolkit (GWT) is a Java software development framework that makes... serializable Java classes for your request and response. In production, GWT
Dojo Toolkit
Dojo Toolkit       Dojo is the Open Source JavaScript toolkit that helps you build serious applications in less time. It fills in the gaps where JavaScript and browsers don't go quite
DHTMLX Toolkit
DHTMLX Toolkit       DHTMLX Ajax Toolkit combines the most widely-used types of UI components: grid, treegrid, treeview, combobox, tabbar, menu, toolbar. All components are written
HP OCMP vXML developer toolkit
HP OCMP vXML developer toolkit       The HP OpenCall Voice Application Developer Toolkit... OpenCall Voice Application Developer Toolkit, you can: * Create VoiceXML
Cross-platform programming with Java technology and the IBM Web Services Toolkit for Mobile Devices
Cross-platform programming with Java technology and the IBM Web Services Toolkit for Mobile Devices         When you?re writing a Java application
What is AWT in java
What is AWT in java In this Example we will describe awt in java. The awt in java stands for Abstract Windowing Toolkit and is a package... in java full tutorials We have described Interface and Description of AWT Package
Java Swing
Java Swing       Swing works as a widget toolkit for Java and is a part of JFC and are replacement... interface (GUI) components for Java programs. Swings are lightweight and 100
WAP Toolkits Motorola - Mobile ADK 1.1 Nokia - WAP Toolkit
ColdJava Java components with WAP/WML... Enhydra - Java/XML server 3.0... JAWAP (Java framework) 1.3.1B1
New Releases
;   Sun?s released the Java Wireless Toolkit 2.5.2 Sun has released the Java Wireless Toolkit 2.5.2. The Toolkit includes build tools, utilities..., extensible framework for creating enterprise Java web applications
SWTCalendar
SWTCalendar         SWTCalendar is a port of Kai Toedter's JCalendar to Eclipse's SWT. It is a GUI date picker for Java using SWT as the GUI toolkit. SWTCalendar
Graphical User Interfaces
; A class library is provided by the Java programming language which is known as Abstract Window Toolkit (AWT). The Abstract Window Toolkit... to the display area with a layout manager. As the Java programming language, the AWT
AonixADT Ada Development Toolkit
AonixADT Ada Development Toolkit       Combine User-Friendliness and Productivity Eclipse offers a common platform for which many companies have developed plug-ins
AWT basics
for abstract window toolkit, which is used to develop platform-independent windowing, graphics, and user-interface for the desktop application using Java technology
java
java  java swing   Swing is a principal GUI toolkit for the Java programming language. It is a part of the JFC (Java Foundation Classes), which is an API for providing a graphical user interface for Java programs
j2s
j2s       Java2Script (J2S) Pacemaker provides an Eclipse Java to JavaScript/HTML/CSS compiler plugin and an implementation of JavaScript version of Eclipse Standard Widget Toolkit (SWT
Image Size
; This Java awt (Abstract Windowing Toolkit) tutorial describes about the image size... of image. You will try and get it. Description of code: Toolkit(): This is the constructor of Toolkit class that is the abstract super class of all exact
java swing
java swing  what is java swing   Swing is a principal GUI toolkit for the Java programming language. It is a part of the JFC (Java Foundation Classes), which is an API for providing a graphical user interface for Java
Creating List in Java using SWT
Creating List in Java using SWT   ... of certain items using the Standard Widget Toolkit In this example, we have create a list... org.eclipse.swt.widgets to create the list in Java language. The style SWT.MULTI provided
Java-Swings - Java Beginners
Java-Swings  How to set the size of a JButton,JLabel depending...*; public class ButtonSizeDemo extends JFrame { private Toolkit toolkit..."); setSize(300, 200); toolkit = getToolkit
HiberObjects
and unit tests for Java Persistence API (JPA) or Hibernate. PropertyChange support and DTO's for Google Web Toolkit (GWT) can also be generated. HiberObjects... to generate Java classes and Hibernate mapping files (depending on the selected
Java2Script (J2S) Pacemaker
an Eclipse Java to JavaScript compiler plugin and an implementation of JavaScript version of Eclipse Standard Widget Toolkit (SWT) with other common utilities... learning. All you have to do is to develop your Java applications in Eclipse
java
).The Abstract Window Toolkit supports GUI Java programming. It is a portable... Toolkit provides the connection between your application and the native GUI. The AWT provides a high level of abstraction for your Java program since it hides you
Eclipse Plunging/Web
the Google Web Toolkit (GWT). With GWT Designer, you can use the visual designer and Java code will be generated for you. You can easily add controls using... The Struts Console is a FREE standalone Java Swing application (or IDE
Java Swing
Java Swing      ... Java programs with a graphical user interface (GUI). There are many components which are used for the building of GUI in Swing. The Swing Toolkit consists
Setting the Icon for the frame in Java
Setting the Icon for the frame in Java   ... to the frame. Toolkit class has been used to get the image and then the image is used to display as frame icon. Toolkit class is used to bind the various
WebOfPatterns
;   The WebOfPatterns (WOP) is a toolkit that facilitates the sharing...: Find pattern instances in Java programs (pattern x-ray), and process... on such a version of Eclipse), and Java 5 are required. Access to source code is possible
How to flip image
() method of ToolKit class provides the default toolkit. The method getImage() of class ToolKit returns an image. The MediaTracker class provides a media
java - Java Beginners
java   What is the different between swing and awt?  Hi Friend, Differences: 1) AWT stands for Abstract windows toolkit whereas le Swing is also called as JFC?s (Java Foundation classes). 2) AWT components use
Java Plateform Micro Edition
For Windows: Download the Sun Java Wireless Toolkit for CLDC from http... the installer, sun_java_wireless_toolkit- 2_5_1-windows.exe. Follow... by the installer. III. install Sun Java ME Wireless Toolkit 2.5.1 (WTK
java
java  what is awt   Hi Friend, AWT stands for Abstract Window Toolkit. The package java.awt contains all classes that creates an interface between the user and different window toolkits. You can use the AWT package
TruStudioPHP
TruStudioPHP       Dynamic Languages Toolkit Dynamic Languages Toolkit (DLTK) is a tool for vendors, researchers, and end-users who rely on dynamic languages
W - Java Terms
.     Sun Java Wireless Toolkit The Sun Java Wireless Toolkit is also known as Java Platform, Micro Edition (Java ME) Wireless Toolkit. Java... W - Java Terms      
Java Swing : JFrame Example
Java Swing : JFrame Example In this section, you will learn how to create a frame in java swing. JFrame : JFrame class is defined in javax.swing.JFrame....;); frame.setVisible(true); JTextArea area=new JTextArea(10, 40); Toolkit toolkit
java awt package tutorial
Java AWT Package In Java, Abstract Window Toolkit(AWT) is a platform independent widget toolkit for windowing, graphics, and user-interface. As the Java... every platform's native GUI toolkit. One of the AWT's significance
Popup dialog box in java
on your application due to some event. With the help of java swing toolkit, you can create popup dialog box. Java swing toolkit provide tow types of dialog box...Popup dialog box in java  How to display popup dialog box in java
Ajax Framework
. Google Web Toolkit:- Google Web Toolkit (GWT) is an open source Java software...; Dojo:- Dojo is an open Source DHTML(Dynamic Hypertext Markup Language)toolkit... build tools. Java Backbase:- Backbase is an Enterprise Ajax Framework for creating
IDE
; HP OCMP vXML developer toolkit   The HP OpenCall Media Platform (OCMP) vXML Developer Toolkit transforms Eclipse into a fully-functional VoiceXML... Java EasyEclipse Expert Java is a bare-bones Eclipse distro for experienced
Setting an Icon for a Frame in Java
Setting an Icon for a Frame in Java   ... an icon for the frame in Java Swing. This program helps us to set the icon (image... getImage(). frame.getDefaultToolkit(): This is the method of the Toolkit class which
Java AWTException Class Hierarchy Diagram
Java AWTException Class Hierarchy Diagram In this section we will discuss about the class hierarchy of AWTException Class in Java. This class extends the java.lang.Exception class. This exception indicates an Abstract Window Toolkit
TruStudio Foundation
TruStudio Foundation       Dynamic Languages Toolkit (DLTK) is a tool for vendors, researchers, and end-users who rely on dynamic languages. DLTK is comprised of a set
ATL
ATL       ATL (ATLAS Transformation Language) is a model transformation language and toolkit developed by the ATLAS Group (INRIA & LINA). In the field of Model-Driven
Advertisements
 

 

 

DMCA.com