G.drawString giving error in a simple program What is my mistake recti pls
Iam new to JAVA just trying to print Hii on the applet and it is giving an error saying
Cannot find symbol
symbol : method drawString(java.lang.String)
location: class java.awt.Graphics
g.drawString("Hi");
^
The prog is
import javax.swing.*; // even if i change it to import java.applet.Applet it gives error
import java.awt.*;
public class trial extends JApplet // if i import the commented iam using extends Applet
public void paint(Graphics g)
g.drawString( " Hii " );
}
If you are new to Java, stay away from applets and other GUI programs until you know how to program Start here:
[http://java.sun.com/docs/books/tutorial/getStarted/index.html]
Similar Messages
-
hey I'm a beginner to java and i tried to program a simple calculator but my Jcreator says it has an Error this is the program that i encoded:
import javax.swing.JOptionPane;
public class quiz
public static void main(String[]args)
String input;
double quiz1,quiz2,quiz3,quiz4,quiz5,average;
input=JOptionPane.showInputDialog("Enter first quiz:");
Double.parseDouble(input);
input=JOptionPane.showInputDialog("Enter second quiz:");
Double.parseDouble(input);
input=JOptionPane.showInputDialog("Enter third quiz:");
Double.parseDouble(input);
input=JOptionPane.showInputDialog("Enter fourth quiz:");
Double.parseDouble(input);
input=JOptionPane.showInputDialog("Enter fifth quiz:");
Double.parseDouble(input);
average=(quiz1+quiz2+quiz3+quiz4+quiz5)/5
JOptionPane.showMessageDialog(null,"The average is" +average,"Average",JOptionPane.INFORMATION_MESSAGE);
System.exit(0);
}shouldn't it be like
input=JOptionPane.showInputDialog("Enter first quiz:");
if (input == null) {
return;
quiz1 = Double.parseDouble(input); or something like that?
or else your "quiz" variable don't have any value?
Edited by: Billwaa on Dec 14, 2008 8:31 AM -
I am using jcreator where i am getting this error while compiling
Error : Invalid path, "C:\Program Files\Java\j2re1.4.2_05\bin\javac.exe" -classpath "C:\Program Files\Xinox Software\JCreatorV3LE\MyProjects\zeroCode\classes" -d C:\Program" Files\Xinox "Software\JCreatorV3LE\MyProjects\zeroCode\classes C:\Program" Files\Xinox Software\JCreatorV3LE\MyProjects\zeroCode\src\BasicServiceLister.java
Instead of that same program is compiling in textpad/eclipse easily.
Please tell me what should i do to set what.
present settings are:
User Variable:
classpath C:\Program Files\Xinox JCreatorV3LE\MyProjects\zeroCode\ classes
Java_HOme: C:\Program Files\Java\j2re1.4.2_05\bin\javac.exe
Path:C:\Program Files\Java\j2re1.4.2_05\bin
Classpath is System Variables:
C:\Program Files\Xinox Software\JCreatorV3LE\MyProjects\zeroCode\ classes
Path :C:\Program Files\Java\j2re1.4.2_05\bin
wher i really need to modify the settings:
May be thorugh command prompt.
I never did. windowds environment varaibles i can set.
Thanks
Vijendra... -d C:\Program" Files\Xinox "Software\JCreatorV3LE\MyProjects\zeroCode\classes ...
Looks like you are typing in things wrong with the double quotes. -
Error in executing the program,what can be the error
Error in executing the program.
What can be the error ,if the error shown is PROGRAM ABC DOE! after entering the values in selection screen?Hi,
Use find to search globally for message in the program.
Check the message that is handled in the program in the selection screen validations.Double click and find out the message.Then you can easily trace why it's happening. -
Using FM DD_POPUP_TO_CONFIRM_CANCEL giving error in module pool program
HI,
I am using FM DD_POPUP_TO_CONFIRM_CANCEL in my module pool program.
But when the cursor comes to the FM it is throwing error like
*CALL SCREEN (not modal) in modal dialog box not allowed.*
i am using the below code.
CALL FUNCTION 'DD_POPUP_TO_CONFIRM_CANCEL'
EXPORTING
textline1 = 'UFN Preprint record created!'
textline2 = 'Proceed to Add more States ?'
title = 'Confirmation'
start_column = 25
start_row = 15
defaultpos = 'C'
IMPORTING
answer = lv_answer.
Regards
JaiHi,
Please try to use FM: 'POPUP_TO_CONFIRM'.
Cheers, -
Plz tell me the error at this simple program
at this orogram i want the user to input the number and then he get th factorial...
my program is:
import javax.swing.JOptionPane;
public class Ch4_32a
public static void main (String[]args)
int f=1, i=1,N;
String E;
String M = JOptionPane.showInputDialog("Enter the number");
N=Integer.parseInt(M);
while(i<=N);
f=f*i;
i++;
JOptionPane.showMessageDialog(null,"the factorial is"+E);
f=Integer.parseInt(E);
******and when i copile it the result is:
C:\Documents and Settings\F A M I L Y\Desktop\MyProgs\azza\Ch4_32a.java:22: variable E might not have been initialized
JOptionPane.showMessageDialog(null,"the factorial is"+E);
^
1 error
it tell me to init the value of E but ir is a string,,
so plz help me to get the real errori delete the (parseInt{) and compile it completle
but when i excut it the firs widow appear (Ent the number)
i Enter the number and then "ok" but the second window don't appear which well tell me the result({f) -
folks.. i have taken the sample program of a simple sniffer.. but its not working.... it is giving syntax error saying
" for each statements are only available if source level is 5.0"
import jpcap.*;
import jpcap.packet.Packet;
class Tcpdump implements PacketReceiver {
public void receivePacket(Packet packet) {
System.out.println(packet);
public static void main(String[] args) throws Exception {
NetworkInterface[] devices = JpcapCaptor.getDeviceList();
System.out.println("usage: java Tcpdump <select a number from the following>");
for (int i = 0; i < devices.length; i++) {
System.out.println(i+" :"+devices.name + "(" + devices[i].description+")");
System.out.println(" data link:"+devices[i].datalink_name + "("
+ devices[i].datalink_description+")");
System.out.print(" MAC address:");
// Giving Error in the following for Loop
for (byte b : devices[i].mac_address)
System.out.print(Integer.toHexString(b&0xff) + ":");
System.out.println();
// Giving Error in the following for Loop
for (NetworkInterfaceAddress a : devices[i].addresses)
System.out.println(" address:"+a.address + " " + a.subnet + " "
+ a.broadcast);it is giving error in the follwing lines of code
for (byte b : devices.mac_address)----------------------> here is error
System.out.print(Integer.toHexString(b&0xff) + ":");
System.out.println();
for (NetworkInterfaceAddress a : devices[i].addresses)-------->here
System.out.println(" address:"+a.address + " " + a.subnet + " "
+ a.broadcast); -
Error, while calling driver program for Smartforms
Hi All,
I am getting a error while running DRIVER PROGRAM of smart form.
both driver program and smart form running successfully without any error while executing separately. But
while calling Smart Form from driver program. it is giving error as :-
*Events are already defined.*
Description :- You tried to define events for a section, but a section with
events is already active. You are not allowed to nest events.
Regards,
Pavan.MThis is nothing to do with coding, this coz of error is from smartforms....
Regards,
Pavan.M -
A way to display error messages from the program
Dear all,
I am looking forward to display a set of error messages(in a internal table) during the execution of the program to the user.
I wanted to know the better way of displaying error messages from my program with more options.
Well I tried out using displaying errors as ALV list/Grid or as simple list processing.
But I found some stanadard transactions (Like in MM and FI where errors are shown in a better way, but failed to find out how they are done.
Please guide me.
Thanks in advance
AryanTry to use application logging it has a very good way to display a set of messages.
[http://abap4.tripod.com/Using_Application_Logging.html|http://abap4.tripod.com/Using_Application_Logging.html]
Run this report in se38 an example sap report to understand logging way to show a set of messages
Report Name : SBAL_DEMO_01
Edited by: Vighneswaran CE on Dec 19, 2010 3:01 PM
Edited by: Vighneswaran CE on Dec 19, 2010 3:11 PM -
Giving error message when saving the Query
Hello,
I have added a new calculated key figure to the structure in a Query but when I try to save the Query it is giving error message is below.
Error Message:
u201CThis internal error is an intended termination resulting from a program state that is not permitted.
Procedure
Analyze the situation and inform SAP.
If the termination occurred when you executed a query or Web template, or during interaction in the planning modeler, and if you can reproduce this termination, record a trace (transaction RSTT).
For more information about recording a trace, see the documentation for the trace tool environment as well as SAP Note 899572u201D.
Could any one please suggest me how can I over come with this problem.
Thanks
Prathap.Hi Prathap,
There is some problem in the definition of the Query.
Please click on the check button before saving the query, it gives where the problem exists in it.
Hope it helps.
Veeerendra. -
Hi friends,
I am tryin java mapping for first time.. and created one java program using link https://www.sdn.sap.com/irj/scn/wiki?path=/display/xi/wholePayloadtoaXML+field
But when I am compiling it using JAVAC, I am getting following error message that
package com.sap.aii.mapping.api does not exist . How can I solve this error.
Complete error is as follows:
C:j2sdk1.4.2_16-x64 in>javac PayloadToXMLField.java
PayloadToXMLField.java:1: package com.sap.aii.mapping.api does not exist
import com.sap.aii.mapping.api.StreamTransformation;
^
PayloadToXMLField.java:2: package com.sap.aii.mapping.api does not exist
import com.sap.aii.mapping.api.AbstractTrace;
^
PayloadToXMLField.java:3: package com.sap.aii.mapping.api does not exist
import com.sap.aii.mapping.api.StreamTransformationConstants;
^
PayloadToXMLField.java:8: cannot resolve symbol
symbol : class StreamTransformation
location: class PayloadToXMLField
public class PayloadToXMLField implements StreamTransformation {
^
PayloadToXMLField.java:16: cannot resolve symbol
symbol : class AbstractTrace
location: class PayloadToXMLField
AbstractTrace trace;
^
PayloadToXMLField.java:27: cannot resolve symbol
symbol : class AbstractTrace
location: class PayloadToXMLField
(AbstractTrace) param.get(
^
PayloadToXMLField.java:28: cannot resolve symbol
symbol : variable StreamTransformationConstants
location: class PayloadToXMLField
StreamTransformationConstants.MAPPING_TRACE);
^
PayloadToXMLField.java:43: cannot resolve symbol
symbol : variable outputPayload
location: class PayloadToXMLField
outputPayload =
^
PayloadToXMLField.java:50: cannot resolve symbol
symbol : variable outputPayload
location: class PayloadToXMLField
out.write(outputPayload.getBytes());
^
9 errors
Thanks,
Brijesh Sonithanks , it is done now..
the program is compiled properly and class file is generated.
but m gettin error in mapping.
in IR i created two message type with data type as string.
and i had imported the class file and java program using Imported archives.
now in interface mapping mapping program i had selected type as Java Class.and name of java program.
but when i tested it, it is giving error as Linkage error occurred when loading class zip/PayloadToXMLField
Please suggest, M i doing some thing wrong?is any thing missing?
Program tht i had used in java
from link (https://www.sdn.sap.com/irj/scn/wiki?path=/display/xi/wholePayloadtoaXML+field):
import com.sap.aii.mapping.api.StreamTransformation;
import com.sap.aii.mapping.api.AbstractTrace;
import com.sap.aii.mapping.api.StreamTransformationConstants;
import java.util.Map;
import java.io.*;
public class PayloadToXMLField implements StreamTransformation {
String strXML = new String();
String outputPayload = new String();
//Declare the XML tag for your XML message
String StartXMLTag = "<Payload>";
String EndXMLTag = "</Payload>";
AbstractTrace trace;
private Map param = null;
public void setParameter(Map param) {
this.param = param;
public void execute(InputStream in, OutputStream out) {
trace =
(AbstractTrace) param.get(
StreamTransformationConstants.MAPPING_TRACE);
trace.addInfo("Process Started");
try {
StringBuffer strbuffer = new StringBuffer();
byte[] b = new byte[4096];
for (int n;(n = in.read(b)) != -1;) {
strbuffer.append(new String(b, 0, n));
strXML = strbuffer.toString();
} catch (Exception e) {
System.out.println("Exception Occurred");
outputPayload =
"<?xml version="1.0" encoding="UTF-8"?>"
+ StartXMLTag
+ strXML
+ EndXMLTag;
try {
out.write(outputPayload.getBytes());
trace.addInfo("Process Completed");;
} catch (Exception e) {
trace.addInfo("Process Terminated: Error in writing out payload");;
and detailed trace of error is:
11:34:21 Start of test
LinkageError at JavaMapping.load(): Could not load class: zip/PayloadToXMLField
java.lang.NoClassDefFoundError: zip/PayloadToXMLField (wrong name: PayloadToXMLField) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.lang.ClassLoader.defineClass(ClassLoader.java:448) at com.sap.aii.ibrep.server.mapping.ibrun.RepMappingLoader.findClass(RepMappingLoader.java:175) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at com.sap.aii.ibrep.server.mapping.ibrun.RepJavaMapping.load(RepJavaMapping.java:136) at com.sap.aii.ibrep.server.mapping.ibrun.RepJavaMapping.execute(RepJavaMapping.java:50) at com.sap.aii.ibrep.server.mapping.ibrun.RepMappingHandler.run(RepMappingHandler.java:80) at com.sap.aii.ibrep.server.mapping.rt.MappingHandlerAdapter.run(MappingHandlerAdapter.java:107) at com.sap.aii.ibrep.server.mapping.ServerMapService.transformInterfaceMapping(ServerMapService.java:127) at com.sap.aii.ibrep.server.mapping.ServerMapService.transform(ServerMapService.java:104) at com.sap.aii.ibrep.sbeans.mapping.MapServiceBean.transform(MapServiceBean.java:40) at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0_0.transform(MapServiceRemoteObjectImpl0_0.java:167) at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0_0p4_Skel.dispatch(MapServiceRemoteObjectImpl0_0p4_Skel.java:104) at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:319) at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:200) at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:136) at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33) at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41) at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37) at java.security.AccessController.doPrivileged(Native Method) at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:102) at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:172)
11:34:21 End of test -
Error messages in ABAP program are stored in which table
hi all,
Can anyone tell
error messages in ABAP program are stored in which table??Hi Sir ,
Please have a look below .Hope it is suitable and simpler solution for your question.
Please do reward if useful.
Thankx.
Fuction module for storing error messages ->'format_message'
for example...
data : v_message(100) type c.
call transaction NNNN mode A update S messages into it_messages.
loop at it_messages where msgty = 'E'.
call function 'format_message'
exporting
*it_messages details
importing
v_message.
write :/ v_message.
clear v_message.
endloop.
Anothe method - ->
Here is a sample of the program code for that:
LOOP AT it_messtab.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = it_messtab-msgid
lang = it_messtab-msgspra
no = it_messtab-msgnr
v1 = it_messtab-msgv1
v2 = it_messtab-msgv2
IMPORTING
msg = g_msg
EXCEPTIONS
OTHERS = 0.
IF it_messtab-msgtyp = 'S'.
it_sucess-sucess_rec = g_msg.
it_sucess-lifnr = it_header-lifnr." Based on your field
it_sucess-tabix = v_lines.
APPEND it_sucess.
ELSEIF it_messtab-msgtyp = 'E'.
it_error-error_rec = g_msg.
it_error-lifnr = it_header-lifnr.
it_error-tabix = v_lines.
APPEND it_error.
ELSE.
it_info-info_rec = g_msg.
it_info-lifnr = it_header-lifnr.
it_info-tabix = v_lines.
APPEND it_info.
ENDIF.
ENDLOOP. -
Error when Generating the Program
Recently there was an SP upgrade and my Planning Book started giving me this error message (SCM version =5.0 and SP = 7)
"Error when generating the program" Message no. /SAPAPO/TSM141
Diagnosis: Generated programs are programs that are generated based on individual data objects, such as planning object structure, planning areas and Infocubes. These programs are then executed in the transaction. An error occured during the generation of such a program
Possible causes:
1. The template has been corrupted
2. The object that the template uses to generate the program contains inconsistencies; for instance an Infocube has not been activated
This error occurs when I try to open the my planning book/creating the selection profile. I've re-activated the Infocube and later deactivate and active my POS and tried to do the same for the Planning Area....but the error still persists. I tried to create a new planning area and tried it again but the error still persists. I've tried to fix any inconsistencies in the planning area time series objects by running the consistency check....however the same error pops up during the consistency check....
Anyone encountered this error message and any possible solutions to this issue.
Thanks
SurenderI did find an ABAP Dump when looking at ST22. The short message is as follows:
Runtime Errors GEN_BRANCHOFFSET_LIMIT_REACHED
Date and Time 05/14/2007 19:33:54
Short text
Jump distance is too large and cannot be generated.
What happened?
A jump distance is too large and cannot be generated.
A control structure or a routine with "CHECK" or "EXIT" contains
too many ABAP statements.
Error in the ABAP Application Program
The current ABAP program "GP_MET_PSTRU_BASIC_FORMS" had to be terminate
because it has
come across a statement that unfortunately cannot be executed.
What can you do?
Note down which actions and inputs caused the error.
To process the problem further, contact you SAP system
administrator.
Using Transaction ST22 for ABAP Dump Analysis, you can look
at and manage termination messages, and you can also
keep them for a long time.
Error analysis
During the generation of program "GP_MET_PSTRU_BASIC_FORMS", the system
determined that
within an ABAP event a control structure (for example, IF..ENDIF
or LOOP..ENDLOOP) or a routine (for example, FORM routine) has
become too large. The resulting jump distance is too large so that
it could no longer be generated.
With the internal load format, the jump distance must not be
greater than 32768 (this is the size of approximately 10.000
ABAP statements).
The jump distance that is to be generated, however, is 50885.
How to correct the error
The ABAP application program must be changed. -
IW32- order-print is giving error for particular User.
Dear Friends,
IW32- order-print is giving error for particular User and output type. Debugging authorization restricted on the system, hence I canu2019t trace out the problem. If anybody comes across such issues, please reply to the post.
Thanks In Advance for your reply.
Anil Dasari
Thanks In Advance.Hi,
Information about dump:
1. User and Transaction:
Runtime Errors MESSAGE_TYPE_X
Date and Time 06.05.2011 10:47:40
MM Used. 13116304
MM Free. 3639760
User and Transaction
Client.............. 700
User................ "BLADEF01"
Language key........ "N"
Transaction......... "IW32 "
Transactions ID..... "4DC387ECA12B684DE10000001A5B1803"
Program............. "/MRSS/SAPLRSG_PM_ORDER"
Screen.............. "SAPLCOIH 3000"
Screen line......... 33
Information on where terminated
Termination occurred in the ABAP program "/MRSS/SAPLRSG_PM_ORDER" - in
"/MRSS/RSG_MAINTAIN_MRS".
The main program was "SAPLCOIH ".
In the source code you have the termination point in line 441
of the (Include) program "/MRSS/LRSG_PM_ORDERU04".
2. Info. Where it got terminated.
Information on where terminated
Termination occurred in the ABAP program "/MRSS/SAPLRSG_PM_ORDER" - in
"/MRSS/RSG_MAINTAIN_MRS".
The main program was "SAPLCOIH ".
In the source code you have the termination point in line 441
of the (Include) program "/MRSS/LRSG_PM_ORDERU04".
3. How to correct the error.
How to correct the error
Probably the only way to eliminate the error is to correct the program.
If the error occures in a non-modified SAP program, you may be able to
find an interim solution in an SAP Note.
If you have access to SAP Notes, carry out a search with the following
keywords:
"MESSAGE_TYPE_X" " "
"/MRSS/SAPLRSG_PM_ORDER" or "/MRSS/LRSG_PM_ORDERU04"
"/MRSS/RSG_MAINTAIN_MRS"
If you cannot solve the problem yourself and want to send an error
notification to SAP, include the following information:
1.1. The description of the current problem (short dump)
To save the description, choose "System->List->Save->Local File
(Unconverted)".
2.2. Corresponding system log
Display the system log by calling transaction SM21.
Restrict the time interval to 10 minutes before and five minutes
after the short dump. Then choose "System->List->Save->Local File
(Unconverted)".
3.3. If the problem occurs in a problem of your own or a modified SAP.
I have been searching for notes recently implemented for IW32.
Thanks and Regards,
ANIL DASARI -
Procedure giving error with collections
H, i wrote a procedure in which i am using collections to out a some data.Its giving error. Below is format of procedure:
Create or replace procabc(a in type_a, b in number, c out type_b)
begin
for i in 1....a.count loop
for j in (select num from abc) loop
if (num = 'condition1') then
c(i) := num;
elsif (num = 'condition2') then
c(i) := num;
elsif (num = 'condition3') then
c(i) := num;
else
dbms_output.put_line('not matching');
end if;
end loop;
end loop;
end;
In above code input a and output c are type which i had created.
how to out my values in out parameter c...its executing ..i am getting print but its not storing in out parameter c which is type. what i need to do..even i had initialised the collection also tried c.event before storing..still wont work..can anyone help me???Megha Verma wrote:
version is oracle 10g...i dont want to use cursors....You already are.
for j in (select num from abc) loop
1 loop is there because i am passing a array as input and i need all values from query whose output depends on that.You're passing an array, but you aren't using it anywhere!!!
for i in 1....a.count loopa is not referenced in any subsequent code.
second loop is to execute the query and get the data and store it in a collection. and return it to ut parameter...what i need to add values to my collection....Yes, and it's extremely inefficient (if it's even correct, seeing my previous comment about not using the collection you pass in anywhere).
>
c is out parameter and is a type(i had created).
simply i want to know how to add values to it while i get my data when loop executes....it prints my valus...just tell how to add it to collections and return it as out parameter.Sadly it's not that simple. Simple to correct technically yes, but your entire process seems to be flawed so i really think you should revisit that. Or post sufficient information to have us help you in an actually helpful manner.
Maybe you are looking for
-
Open raw as smart object using droplet
Hello everyone, This is my first post so please be gentle Rather than a droplet opening a raw file in a regular layer, is it possible to open the raw file as a smart object so that the object can be edited in Camera Raw later on? Thanks for your time
-
Why can't I get messages to work in new iPad?
I have new wireless ipad and the ipad1 When trying to use messages it works in ipad1 but I get Could not sign in Please check your network settings and try again message. the facetime won't activate either. my network works because I can get onli
-
How to get the Overall result and Avg in Query
Hi I am facing a problem to find Overall result and Avg for the keyfigure. Here is the scenario. I have a fiscalperiod ,qty in query column and material in row, when user enters the fiscalperiod(004.2006 to 006.2006) the output should come as 0406
-
System error in program SAPLRRK0
Hi All, Every day morning when I execute a query iam getting these messages SQL Error: 768- System error in program SAPLRRK0 and form RSRDR;SRRK0F30-01- but after some time when i execute the same query its running fine. Iam getting this every day mo
-
DbConnectionAttributes for XML data source
Post Author: zmtun CA Forum: .NET I use XML document which includes both Schema and data. I'd like to get DbConnectionAttributes to set to the crystal report's ConnectionInfo property. Thanks.