Create an instanz of a class
Hello,
I am devloping an a simple struts Applikation (Name Hello)
The structur my Webapp.
the Applikation ist in C:\Tomcat\webapps\Hello
HelloAction.java in
C:\Tomcat\webapps\Hello\WEB-INF\classes\org\java\example
HelloForm.java in
C:\Tomcat\webapps\Hello\WEB-INF\classes\org\java\example
code:
public
package org.java.example;
public class HelloForm
package org.java.example;
public class HelloAction
public ActionFrward execute( ....)
HelloForm helloForm = new HelloForm();
I compile the class HelloForm to create FelloForm.class // no problem
I compile the class HelloAction ERROR !!!!!!!!!!!
C:\Tomcat\webapps\Hello\WEB-INF\classes\org\java\example>javac HelloAction.java
cann not resolve sympole
sympole: class HelloForm
location: org.java.example.HelloAction
HelloForm helloForm=new HelloForm();
what is to change
the CLASSPATH or something in conf. of tomcat or ???
thanks
there ar somone in this world to help me !!!
Similar Messages
-
Error while creating a overwrite method in class
Hello.
I'm trying to create an overwrite method in the class CL_HREIC_EECONTACT2SRCHV_IMPL but it just won't let me. Every time I try I get the message "The class has not yet been converted to the new class-local types" and I cannot create it.The thing is I've tried to create overwrite methods in diferent classes and sometimes I get the message and sometimes I don't, so it seems to depend on the class I'm trying to enhance, but I don't seem to be able to see any pattern in it.
Any help?
ThanksHello i had the same problem and i couldn't create enhancement pre or post methods.
The message was:
The class has not yet been converted to the new class-local types
Exception of class CX_ENH_OLD_LOCAL_CLASS_TYPES
This can be fixed by entering in SE24 transaction: Change class. From menu choose: Utilities -> Convert class-local types.
After that activate the class.
Now the class can be enhanced.
However this action requires change of the class
Regards,
Rosen -
Creating a triangle using polygon class problem, URGENT??
Hi i am creating a triangle using polygon class which will eventually be used in a game where by a user clicks on the screen and triangles appear.
class MainWindow extends Frame
private Polygon[] m_polyTriangleArr;
MainWindow()
m_nTrianglesToDraw = 0;
m_nTrianglesDrawn = 0;
m_polyTriangleArr = new Polygon[15];
addMouseListener(new MouseCatcher() );
setVisible(true);
class MouseCatcher extends MouseAdapter
public void mousePressed(MouseEvent evt)
Point ptMouse = new Point();
ptMouse = evt.getPoint();
if(m_nTrianglesDrawn < m_nTrianglesToDraw)
int npoints = 3;
m_polyTriangleArr[m_nTrianglesDrawn]
= new Polygon( ptMouse[].x, ptMouse[].y, npoints);
}When i compile my code i get the following error message:
Class Expected
')' expectedThe two error messages are refering to the section new Polygon(....)
line. Please helpCannot find symbol constructor Polygon(int, int, int)
Can some one tell me where this needs to go and what i should generally
look like pleaseI don't think it is a good idea to try and add the constructor that the compiler
can't find. Instead you should use the constructor that already exists
in the Polygon class: ie the one that looks like Polygon(int[], int[], int).
But this requires you to pass two int arrays and not two ints as you
are doing at the moment. As you have seen, evt.getPoint() only supplies
you with a single pair of ints: the x- and y-coordinates of where the mouse
button was pressed.
And this is the root of the problem. To draw a triangle you need three
points. From these three points you can build up two arrays: one containing
the x-coordinates and one containing the y-coordinates. It is these two
arrays that will be used as the first two arguments to the Polygon constructor.
So your task is to figure out how you can respond to mouse presses
correctly, and only try and add a new triangle when you have all three of its
vertices.
[Edit] This assumes that you expect the user to specify all three vertices of the
triangle. If this isn't the case, say what you do expect. -
Creat transaction (se93) for Globa class in ABAP Objects
Hi experts,
Can any one tell me how to
creat transaction (se93) for Globa class(se24) in ABAP Objects
if ,please assest me how to do it or send me example docu on this
best Answer will be rewarded
regards
fareedashi
se93->give your transaction ->enter create.
check the radio button (Method of calss(OO class).press enter.
in next screen.
transaction text ;give your own description
tick the check box OO transaction model.
give the class name method name which u have created in se 24.which was activated successfully.it should be activated otherwise it will not work.
under GUI SUPPORT.
TICK the all 3 check boxes.
SAP GUI FOR HTML
JAVA
WINDOWS.
then save.
u should b saved in package(don't forget).
it was working.
i have already checked and did it succesfully.
reward points
if u have any queries let me know.
kiran jagana -
Not able to created Number Ranges for Asset Classes in AS08
Dear Friends,
I am not able create Number Ranges for Asset Classes in AS08.
It is giving me an error message as company code does not exist.
When I Check Consistency under path SPRO -> Financial Accounting -> Asset Accounting -> Preparing for Production Startup -> Check Consistency -> Overview Report: Company Codes. I am getting the following
RSOL Reliance Sealink One PLtd
CoCode no. alloc. NKTR
Fiscal Year Variant V3 Apr.- March, 4 special periods
Start 2nd half month 00
Transfer date 31.03.2006
Chart of dep. TOLL Chart of Depreciation - For Highway Projects
Net worth tax 01 Book depreciation as per Compinies Act 1956
Enter net book value
Status company code 2
Current fiscal year 2007
Doc. type dep. pstng AF Dep. postings
> Number range &1 in co.code &2 for doc.type &3 must be defined as internal
Calc.insur.value
Input tax exempt
If you see the above first two line you will find the difference is that Company code RSOL in the first line and NKTR company code in the second line.
Actually CoCode no. alloc. has been wrongly copied as NKTR while copying CoCode it should be RSOL and not NKTR.
I think because of this wrong allocation it is giving me an error in AS08. Also it is not showing me CoCode in drop down list in AS08.
Please help me to resolve the problem.
Thanks
Rahul JainLook in TC OAOB if the company code is assigned to a chart of depreciation
-
Why can't I create new object from a class that is in my big class?
I mean:
class A
B x = new B;
class B
and how can I solve it if I still want to create an object from B class.
Thank you very much :)public class ItWorksNow {
public ItWorksNow() {
public static void main ( String[] argv ) throws Exception {
ItWorksNow.DaInnaClass id = new ItWorksNow().new DaInnaClass();
public class DaInnaClass {
} -
Re: How do you create and use "common" type classes?
Hi,
You have 2 potential solutions in your case :
1- Sub-class TextNullable class of Framework and add your methods in the
sub-class.
This is the way Domain class work. Only Nullable classes are sub-classable.
This is usefull for Data Dictionary.
The code will be located in any partition that uses or references the supplier
plan.
2- Put your add on code on a specific class and instanciate it in your user
classes (client or server).
You could also use interface for a better conception if needed. The code will
also be in any partition that uses or references the supplier plan where your
add on class is located.
If you don't want that code to be on each partition, you could use libraries :
configure as library the utility plan where is your add-on class.
You can find an example of the second case (using a QuickSort class,
GenericArray add-on) with the "QuickSort & List" sample on my personal site
http://perso.club-internet.fr/dnguyen/
Hope this helps,
Daniel Nguyen
Freelance Forte Consultant
http://perso.club-internet.fr/dnguyen/
Robinson, Richard a écrit:
I'm relatively new to forte and I'd like to know how can you handle utility
type classes that you want to use through out your application? Ideally
what I want is a static class with static methods.
Let's say that I have a StringUtil class that has a bunch of methods for
manipulating strings.
My problem is that we have code that runs on the client and code that runs
on the server. Both areas could use the StringUtil class, but from what I
understand, I have to create StringUtil in a plan and then create a server
object of type StringUtil. The server object will eventually get assigned
to a partition. That's not good since I really want the server object to
physically reside at the server end and at the client end. (Actually, I
don't want a server object, I just want to invoke a static method of a
static class).
Any clues on how to solve this problem would be appreciated.
Also, what is the url at Sage-it that has a summary of all emails that have
been posted to [email protected]? Perhaps this question has been
answered previously.
Thanks in advance
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>-
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>Hi Richard,
Your question about "utility classes" brings up a number of issues, all of
which are important to long-term success with Forte.
There is no such thing as a static method (method that is associated with a
class but without an implicit object reference - this/self/me "pointer") in
TOOL, nor is there such thing as a global method (method not associated
with a class at all). This is in contrast to C++, which has both, and
Java, which has static methods, but not global classes. Frequently, Forte
developers will write code like this:
result, num : double;
// get initial value for num....
tmpDoubleData : DoubleData = new;
tmpDoubleData.DoubleValue = num;
result = tmpDoubleData.Sqrt().DoubleValue;
tmpDoubleData = NIL; // send a hint to the garbage collector
in places where a C++ programmer would write:
double result, num;
// get initial value for num....
result = Math::Sqrt(num);
or a Java programmer would write:
double result, num;
// get initial value for num....
result = Math.sqrt(num);
The result of this is that you end up allocating an extra object now and
then. In practice, this is not a big deal memory-wise. If you have a
server that is getting a lot of hits, or if you are doing some intense
processing, then you could pre-allocate and reuse the data object. Note
that optimization has its own issues, so you should start by allocating
only when you need the object.
If you are looking for a StringUtil class, then you will want to use an
instance of TextData or TextNullable. If you are looking to add methods,
you could subclass from TextNullable, and add methods. Note that you will
still have to instantiate an object and call methods on that object.
The next issue you raise is where the object resides. As long as you do
not have an anchored object, you will always have a copy of an object on a
partition. If you do not pass the object in a call to another partition,
the object never leaves. If you pass the object to another partition, then
the other partition will have its own copy of the object. This means that
the client and the server will have their own copies, which is the effect
you are looking for.
Some developers new to Forte will try to get around the lack of global
methods in TOOL by creating a user-visible service object and then calling
methods on it. If you have a general utility, like string handling, this
is a bad idea, since a service object can reside only on a single
partition.
Summary:
* You may find everything you want in TextData.
* Unless you anchor the object, the instance will reside where you
intuitively expect it.
* To patch over the lack of static methods in TOOL, simply allocate an
instance when required.
Feel free to email me if you have more questions on this.
At the bottom of each message that goes through the mailing list server,
the address for the list archive is printed:
http://pinehurst.sageit.com/listarchive/.
Good Luck,
CSB
-----Original Message-----
From: Robinson, Richard
Sent: Tuesday, March 02, 1999 5:44 PM
To: '[email protected]'
Subject: How do you create and use "common" type classes?
I'm relatively new to forte and I'd like to know how can you handle utility
type classes that you want to use through out your application? Ideally
what I want is a static class with static methods.
Let's say that I have a StringUtil class that has a bunch of methods for
manipulating strings.
My problem is that we have code that runs on the client and code that runs
on the server. Both areas could use the StringUtil class, but from what I
understand, I have to create StringUtil in a plan and then create a server
object of type StringUtil. The server object will eventually get assigned
to a partition. That's not good since I really want the server object to
physically reside at the server end and at the client end. (Actually, I
don't want a server object, I just want to invoke a static method of a
static class).
Any clues on how to solve this problem would be appreciated.
Also, what is the url at Sage-it that has a summary of all emails that have
been posted to [email protected]? Perhaps this question has been
answered previously.
Thanks in advance -
Create an instance of my class variable
Hello all,
I'm a newbie to iPhone/iPad programming and am having some trouble, I believe the issue is that I'm not creating an instance of my class variable. I've got a class that has a setter and a getter, I know about properties but am using setters and getters for the time being. I've created this class in a View-based application, when I build the program in XCode 3.2.6 everything builds fine. When I step through the code with the debugger there are no errors but the setters are not storing any values and thus the getters are always returning 0 (it's returning an int value). I've produced some of the code involved and I was hoping someone could point out to me where my issue is, and if I'm correct about not instantiating my variable, where I should do that. Thanks so much in advance.
<p>
Selection.h
@interface Selection : NSObject {
int _choice;
//Getters
-(int) Choice;
//Setters
-(void) setChoice:(int) input;
Selection.m
#import "Selection.h"
@implementation Selection
//Getters
-(int)Choice {
return _choice;
//Setter
-(void)setChoice:(int)input{
_choice = input;
RockPaperScissorsViewController.m
#import "RockPaperScissorsViewController.h"
@implementation RockPaperScissorsViewController
@synthesize rockButton, paperButton, scissorsButton, label;
//@synthesize humanChoice, computerChoice;
-(void)SetLabel:(NSString *)selection{
label.text = selection;
-(IBAction)rockButtonSelected {
// [self SetLabel:@"Rock"];
[humanChoice setChoice:1];
</p>
So in the above code it's the [humanChoice setChoice:1] that is not working. When I step through that portion with the debugger I get no errors but when I call humanChoice.Choice later on in the code I get a zero.
-NifflerXIt worked, thank you so much. I put
humanChoice = [[Selection alloc]init];
In viewDidLoad and it worked like a charm. Thank you again.
-NifflerX -
Creating multiple instances of a class in LabVIEW object-oriented programming
How do you create multiple instances of a class in a loop? Or am I thinking about this all wrong?
For instance, I read in a file containing this information:
Person Name #1
Person Age #1
Hobby #1
Hobby #2
Hobby #3
Person Name #2
Person Age #2
Hobby #1
Hobby #2
Hobby #3
Person Name #3
Person Age #3
Hobby #1
Hobby #2
Hobby #3
If I define a Person class with name, age, and an array of strings (for the hobbies), how can I create several new Person instances in a loop while reading through the text file?
FYI, new to LabVIEW OOP but familiar with Java OOP. Thank you!First of all, let's get your terminology correct. You are not creating multiple instances of a class. You are creating Objects of the class.
Use autoindexing to create an array of your class type.
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines -
Why cannot create instance to an abstract class?
Dear Developers....
abstract class can create be its own constructor but why they didn't create objectWe cann't create an object for abstract class
because they have abstract methods which depends on
its subclass for its implementation. if it is
possible to create the object for abstract class
means then you can call a method which has no
implementation(abstract methods) which is a illegal
one thats what the ruleWhat about classes with no abstract members?
public abstract class A {}No danger of accessing anything illegal here.
The rule is far more simple. By declaring a class as abstract, the creator defines that no instances of this class may exist. Period. If you could create instances, the class wouldn't be abstract anymore, per definition. It's like asking why a green light doesn't shine red. If it would, it wouldn't be green anymore. -
Trying to create an array of a class
This is the first time ive tried to use an array so its not surprising im having trouble.
this is my program:
import java.util.*;
public class studentRecordDemo
public static void main(String[] args)
int studNum, index;
System.out.println("Enter the number of students you wish to record");
Scanner keyboard = new Scanner(System.in);
studNum = keyboard.nextInt();
studentRecord student[] = new studentRecord[studNum];
for (index = 0; index < studNum; index++)
{student[index].readInput();
student[index].writeOutput();}
}And it lets me compile it but when i enter a number it gives me the error:
Exception in thread "main" java.lang.NullPointerException
at studentRecordDemo.main(studentRecordDemo.java:15)the
So yeah im trying to create an array of the class "studentRecord" and the number is input by the user. Is there a way to make that work or would it be easier to just make the array a really high number?your error is in here:
student[index].readInput();its null...
This is the first time ive tried to use an array so
its not surprising im having trouble.
this is my program:
import java.util.*;
public class studentRecordDemo
public static void main(String[] args)
int studNum, index;
System.out.println("Enter the number of students
ts you wish to record");
Scanner keyboard = new Scanner(System.in);
studNum = keyboard.nextInt();
studentRecord student[] = new
ew studentRecord[studNum];
for (index = 0; index < studNum; index++)
{student[index].readInput();
student[index].writeOutput();}
}And it lets me compile it but when i enter a number
it gives me the error:
Exception in thread "main"
java.lang.NullPointerException
at
studentRecordDemo.main(studentRecordDemo.java:15)the
So yeah im trying to create an array of the class
"studentRecord" and the number is input by the user.
Is there a way to make that work or would it be
easier to just make the array a really high number? -
How to create an instance of a class which is stored in a String?
I've class name stored in a String Object.
now i've to create an instance of that class name.
How?This is very dangerous ground because you give up compile-time safety, but you can get a Class object using Class.forName(String). Then you can use methods of the class Class to operate on it (including creating an instance).
-
How to create an object of a class?
plz read the question carefully ..
how to create the object of a class by giving the class name as an String
suppose i have a java file name:" java1.java ".
so now how to create an object of this class "java1"by passing a string "java1"..kajbj wrote:
rajeev-usendi wrote:
thanks but still i have problem..
i have created the object but now i m unable to do anything with that created object..
i have coded like this..
Object o= Class.forName("java1").new Instance();
after this i m unable to do anything with the object 'o'..So why did you create the instance? You can also get all methods using reflection, but that is probably not what you want to do. You should instead let the class implement an interface and cast the created object into that interface ans call the methods that you want to call.
KajI agree with Kaj. If you need to use a class that's unavailable at compile time, you should create an appropriate interface by which to refer to the class and then you create instances reflectively and access them normally via their interface (which is called reflective instantiation with interface access) -
How to create an instance of a class?
how do you create sn instance of a class, and how do you call a method from another class?
You may need to read thru the information provided on this page to understand how to create objects: http://java.sun.com/docs/books/tutorial/java/data/objectcreation.html
I'd also suggest you read the tutorial available at: http://java.sun.com/docs/books/tutorial/java/index.html
Regarding how you call a method belonging to another class you could do it in the foll. ways depending on whether the method is static or not - a static method may be called using the class name followed by a dot and the static method name while a non-static method would require you to create an instance of the class and then use that instance name followed by a dot and the method name. All said and done i'd still suggest you read thru the complete Java programming tutorial to get a good grounding on all these concepts and fundamentals of the language if you are looking to master the technology.
Thanks
John Morrison -
Creating different instances of one class
Hi everyone thanks so much for all the help so far! I want to create a new instance of class coauthorship everytime the loop goes around to a new record! However thats not whats happening it only creates 1 instance of coauthorship and it is overwritten with every loop here is Class Coauthorship
public class Coauthorship {
private String name, coauthor, title;
private List titles;
/** Creates a new instance of Coauthorship */
public Coauthorship(String name1, String name2, String TITLE){
name = name1;
coauthor = name2;
title = TITLE;
//List titles = Collections.synchronizedList(new ArrayList(alltitles));
public String getauthor(){
return name;
public void settitle(String TITLE){
title = TITLE;
public void setname(String name1){
name = name1;
public void setcoauthor( String name2){
coauthor = name2;
// public void addTitle(String TITLE){
// if(TITLE != null)
// titles.add(TITLE);
public String getcoauthor(){
return coauthor;
public String gettitle(){
return title;
public int getTitleCount(){
return titles.size();
public void printcoauthors(String currentauthor){
//Extractdata ed = new Extractdata();
// Coauthorship c = new Coauthorship(ed.getname1(), ed.getname2(), ed.getTITLE());
if(currentauthor.equals(getauthor()))
System.out.println(getcoauthor());
else if (currentauthor.equals(getcoauthor()))
System.out.println(getauthor());
System.out.println(gettitle());
System.out.println("Hello is this thing on?");
}and here is where the values are coming from in Class Extractdata
//Checks if the document was cowritten
if(authors.getLength() > 0)
for(int z = 0; z < authors.getLength(); z++){
//Begin with the second author so not to include the author in the list of coauthors
for(int w = 1; w < authors.getLength(); w++){
Coauthorship coauthorship = null;
//Ensures that the author is not counted as a co-author
if(z != w){
name1 = names[z];
name2 = names[w];
Coauthorship c = new Coauthorship(name1, name2, TITLE);
c.setname(name1);
c.setcoauthor(name2);
c.settitle(TITLE);
}Thanks so much for everyones help so farOne thing to remember is that when you write:
Coauthorship c = new Coauthorship(name1, name2, TITLE);
Coauthorship c is creating a reference variable that points to an object that is of class type Coauthorship. It is NOT the object itself. It only points to the object in question.
It is the new Coauthorship(...) that actually creats the object in memory. So each time through the loop you are asking for a new Coauthoriship object and a new reference to that new object. Of course, Java (meaning the JVM) may (or always will - not sure here) re-use the reference variable at the same memory location. You loose the reference to each object create in the previous loop iteration leaving you with a reference pointing to the last object created in the loop when the loop ends.
If you could state in plain English what your goal is, that would help. From your code, I can tell that the goal (or problem domain) is not clear. Or at least, how to achieve that goal is not clear. State the requirements using ergular words (not psuedo code or such) that would help get things a little clearer.
Maybe you are looking for
-
Copying Data from a table to new table
Hi, I am copying some columns data from one table to another table and my query is INSERT INTO TestTable (empno, empName,deptno) SELECT empno, empname,deptno FROM emp and it's working fine but I want to insert one more column data into testTable on t
-
I thought Skype was free so why have I been charge...
I have just had a payment taken from my account by Skype. I have no idea what I'm paying for or why. I live on disability benefits and that is more than a weeks food money for something I have never used, don't want and thought was free. I now have n
-
Problem in viewing the webhelp output in a RoboHelp-DocumentX project
Hi, I am working with Robohelp X5. The project is generated together with DocumentX and hence contains more than 15,000 files. Secondly, the proper webhelp output is extremely essential for this project as it concerns the links which are also in thou
-
The year of low cost Windows 8.1 laptops?
Saw an asus 11.6 laptop in the weekly ad for $169. Would be good for people who need a laptop on the go. I think that these things may be a permanent offering thanks to low cost eMMC technology.
-
GRU, HRC, ELB Transactions
Hi gurus, When triyng to set Configure Automatic Posting in MM (trx OBYC), i get this error message: Account 622610 already used in transaction GRU Message no. F4803 Diagnosis Accounts used in transaction BSX (posting to asset balance sheet account)