Cannot resolve Java variables - a Nitrox bug?
Hi. I just installed Nitrox 2.0 to try it with my project. Quite a lot of JSP code shows up as having syntax problems - vairous variables show up as "cannot be resolved" in Eclipse "Problems" tab.
I narrowed down the problem to the following:
<script>
<%String myVar = "Hello";%>
</script>
<%out.println(myVar);%>
myVar is inidcated as "unresolved" in the println statement. Basically if any Java vars are declared inside <script> tags, Nitrox cannot resolve them outside the tags.
My Eclipse version is 3.0.1
Putting the scriptlet before the script tag isn't always an option, though.
Here's an example where I'm doing the typical prefetch of a set of images (so they're in browser cache). The logic:iterator tag is used to traverse a collection that has the image info and to construct the necessary javascript.
<script language="JavaScript" type="text/javascript">
var previews = new Array();
var previewImg;
<logic:iterate id="item" ...>
previewImg = new Image();
previewImg.src = '<%= item.getPreviewImgSrc() %>';
previews[ '<%= item.getName() %>' ] = previewImg;
</logic:iterate>
</script>
In the above example, NitroX complains that "item cannot be resolved", but the "item" bean is defined inside the script tag as part of the logic:iterate tag.
Any suggestions?
Similar Messages
-
I am getting an error cannot resolve symbol variable?
I am trying to run a PdfFormGenerator.java file and am using the iText API, hence have included
the iText.jar file. When I compile the code I keep getting the following two errors:
cannot resolve symbol variable CLASS_LOCATION
cannot resolve symbol variable FORM_LOCATION
can anyone guide me what I may have done wrong.
Thanks,
ZubHi! To be more specific its these to line of the code is were I am going the errors:
private String classLocation = Constants.CLASS_LOCATION;
private String formLocation = Constants.FORM_LOCATION;Thanks -
"cannot resolve symbol" error...please help
when itry to compile my program i get the error " cannot resolve
symbol" variable setLayout.
My program is very small. Can someone tell me why i keep
getting error?
thanx
trin.
import java.applet.*;
import java.awt.*;
public class MyProg extends Applet
Button btnOne = new Button("One");
Button btnTwo = new Button("Two");
public void init()
Panel pOne = new Panel( ) ;
pOne.setLayout = ( new GridLayout( ));
pOne.add(btnOne);
pOne.add(btnTwo);
add(pOne);Change:
pOne.setLayout = ( new GridLayout( ));to
pOne.setLayout( new GridLayout());It's a method call, not an assignment :) -
Need help - method call error cannot resolve symbol
My code compiles fine but I continue to receive a method call error "cannot resolve symbol - variable superman" - can't figure out why. Here is my code:
public static String caesar(String message, int shift)
{ [b]String result = "";
for(int i = 0; i < message.length(); ++i)
{ [b]char newChar = message.charAt(i + shift);
result += newChar;
return result.toUpperCase();
I entered "superman" for message and "3" for the shift. Can someone please help? Thanks!Your post worked great - especially since it made me realize I was going about it all wrong! I was attempting to convert "superman" to "vxshupdq" - basically a cipher shift starting at index 0 and shifting it 3 character values which would result in s changing to v. I restructured my code:
public static String caesar(String message, int shift)
{ [b]String result = "";
for(int i = 0; i < message.length(); ++i)
{ [b]char newChar = message.charAt(i);
result += (newChar + shift) % message.length();
return result.toUpperCase();
But it's displaying the result as a "60305041". How can I get it to display the actual characters? -
Import java.util.Formatter - cannot resolve symbol
I use j2sdk1.4.2_04
when I try to compile my program using Formatter, it response error "cannot resolve symbol"
Pls help!Where did you get this java.util.Formatter from? If you check the official 1.4.2 API for Java, that class does not exisit! However, java.util.logging.Formatter, does exisit...
http://java.sun.com/j2se/1.4.2/docs/api/
If you ment: java.util.logging.Formatter have you checked the API to make sure you are using it correctly???
HTH. -
Cannot resolve symbol java.awt.graphics
// DrawRectangleDemo.java
import java.awt.*;
import java.lang.Object;
import java.applet.Applet;
public class DrawRectangleDemo extends Applet
public void paint (Graphics g)
// Get the height and width of the applet's drawing surface.
int width = getSize ().width;
int height = getSize ().height;
int rectWidth = (width-50)/3;
int rectHeight = (height-70)/2;
int x = 5;
int y = 5;
g.drawRect (x, y, rectWidth, rectHeight);
g.drawString ("drawRect", x, rectHeight + 30);
x += rectWidth + 20;
g.fillRect (x, y, rectWidth, rectHeight);
// Calculate a border area with each side equal tp 25% of
// the rectangle's width.
int border = (int) (rectWidth * 0.25);
// Clear 50% of the filled rectangle.
g.clearRect (x + border, y + border,
rectWidth - 2 * border, rectHeight - 2 * border);
g.drawString ("fillRect/clearRect", x, rectHeight + 30);
x += rectWidth + 20;
g.drawRoundRect (x, y, rectWidth, rectHeight, 15, 15);
g.drawString ("drawRoundRect", x, rectHeight + 30);
x=5;
y += rectHeight + 40;
g.setColor (Color.yellow);
for (int i = 0; i < 4; i++)
g.draw3DRect (x + i * 2, y + i * 2,
rectWidth - i * 4, rectHeight - i * 4, false);
g.setColor (Color.black);
g.drawString ("draw3DRect", x, y, + rectHeight + 25);
x += rectWidth + 20;
g.setColor (Color.yellow);
g.fill3DRect (x, y, rectWidth, rectHeight, true);
g.setColor (Color.black);
g.drawString ("fill3DRect", x, y, + rectHeight + 25);
Help me with this codes. I typed correctly but there still errors.
--------------------Configuration: JDK version 1.3.1 <Default>--------------------
D:\Program Files\Xinox Software\JCreator LE\MyProjects\DrawRectangleDemo.java:56: cannot resolve symbol
symbol : method drawString (java.lang.String,int,int,int)
location: class java.awt.Graphics
g.drawString ("draw3DRect", x, y, + rectHeight + 25);
^
D:\Program Files\Xinox Software\JCreator LE\MyProjects\DrawRectangleDemo.java:64: cannot resolve symbol
symbol : method drawString (java.lang.String,int,int,int)
location: class java.awt.Graphics
g.drawString ("fill3DRect", x, y, + rectHeight + 25);
^
2 errors
Process completed.
-------------------------------------------------------------------------------------------------------------------------------cannot resolve symbol
symbol : method drawString (java.lang.String,int,int,int)
This is telling you that you are trying to invoke the drawString() method with 4 parameters: String, int, int, int
If you look at the API the drawString() method need 3 parameters: String, int, int - so you have an extra int
location: class java.awt.Graphics
g.drawString ("draw3DRect", x, y, + rectHeight + 25);
Now is you look at your code you will find that you have 3 ',' in you method call. (I don't think you want the ',' after the y. -
Hello,
We are seeing a lot of log messages like the one below when an MDO select query is run. There is a message for every numeric column. There doesnt seem to be any issue with the queries working properly its just creating a lot of log messages. Has anyone else had this issue?
Exception of type com.sap.sql.log.OpenSQLException caught:
Cannot fetch column 22, which has JDBC type DOUBLE, into a Java variable of type
float..
[EXCEPTION]
com.sap.sql.log.OpenSQLException: Cannot fetch
column 22, which has JDBC type DOUBLE, into a Java variable of type float.
at com.sap.sql.log.Syslog.createAndLogOpenSQLException(Syslog.java:83) ...Hi Christian,
You are right. As in your case it is a select query it does not reflect the error automatically. In my case, I had an insert query so it failed then and there, which was easier to debug and fix.
I have one question regarding your case. When you read the MDO using the query, what do you do with the output? Do you assign it to any local/transaction property in the output links of the query block or in a proceeding assignment block?
Because, the error mentions that the assignment of float to double datatype fails. So, in theory there should be some assignment done with the output.
Please check if you could figure out this part in your transaction.
Regards,
Saumya Govil -
Sequential.java [28:1] cannot resolve symbol
The program asks users to enter random numbers.They are stored in a vector. The numbers are then added and the results of the addition stored in an vector.ie
sum1=item1
sum2=item1+item2
sum3=item1+item2+item3
sumn=item1+item2+,,,,,+itemn
here is the program
import java.util.Vector;
import java.io.*;
public class Sequential {
/** Creates a new instance of Sequential */
public Sequential() {
public static int inputInt(String str){
BufferedReader input=new BufferedReader(new InputStreamReader(System.in));
System.out.println(str);
int val;
try{
val = Integer.parseInt(input.readLine());
}catch(Exception e){}
return val;
public static void main (String args[]){
//initialising
Vector myarray = new Vector();
Vector sum = new Vector();
int ans = 0;
int dim;
dim = inputInt("Enter the array dimension");
//populate the
for(int i=0; i < dim; i++){
myarray.add(i,inputInt("Enter the array dimension"));
for(int i=0; i < dim; i++ ){
ans = Integer.parseInt(myarray.get(i)) + ans;
sum.add(i,ans);
for(int i=0; i < dim; i++){
System.out.println("Item [" + i + "] is " + sum.get(i));
it dispalys on ".add" part
Sequential.java [28:1] cannot resolve symbol in
myarray.add(i,inputInt("Enter the array dimension"));Vectors store objects, not primitives.
Try the Integer wrapper class, e.g. myarray.add(i, new Integer(inputInt("Enter the array dimension")));
There are some other code problems I think you'll notice, but you should be able to work those out. -
Java Bean Error in JSP: Cannot Resolve Symbol FirstBean
I have created a java bean with following package statement
package mybeans;
and my bean name is
FirstBean
it compile secessfully and now my directory structure is following
WebAppRootDir \ WEB-INF \ classes \ mybeans \ FirstBean.class
I am using Tomcat 4.1 and in JSP i am declaring the bean with following line
<jsp:useBean id="b" class="mybeans.FirstBean" />
and tomcat 4.1 is failed to find this bean and giving me following error
cannot resolve symbol
symbol : class StudentBean
location: package mybeans
mybeans.FirstBean b = null;
all my class and directory structure is ok i am puzzle why this error is coming, plz help me quickly i need solution quickly ...Error is for StudentBean, not for FirstBean. So check for it.
-
Java Bean Error in JSP: Cannot Resolve Symbol Error
I have created a java bean with following package statement
package mybeans;
and my bean name is
FirstBean
it compile secessfully and now my directory structure is following
WebAppRootDir \ WEB-INF \ classes \ mybeans \ FirstBean.class
I am using Tomcat 4.1 and in JSP i am declaring the bean with following line
<jsp:useBean id="b" class="mybeans.FirstBean" />
and tomcat 4.1 is failed to find this bean and giving me following error
cannot resolve symbol
symbol : class FirstBean
location: package mybeans
mybeans.FirstBean b = null;
all my class and directory structure is ok i am puzzle why this error is coming, plz help me quickly i need solution quickly ...It seem to be ok... why dont your try with a newer versi�n of Tomcat?
-
Solaris Deployment Failure for cannot resolve symbol on PersistentContainer
Hello, I'm having trouble diagnosing the following deployment failure.
What are some common causes of this? My server was created using an
Express Integration domain with some custom JMS destinations added
afterwards via the console. I am deploying an application built with
Workshop (straight from workshop). I copied over an application from
Windows to Solaris, deleted the .workshop directory and .beabuild.txt
and rebuilt the application to deploy.
I get this error a few times.
####<Aug 21, 2003 10:48:19 AM EDT> <Info> <EJB> <rhino> <cgServer>
<ExecuteThread: '1' for queue: 'weblogic.kernel.System'> <<WLS Kernel>>
<> <BEA-012033> <Compiling generated EJB classes produced the following
Java compiler output:
/export/data/ident/bea/user_projects/domains/ident1Server.conf/./cgServer/.wlnotdelete/EJBCompilerCache/-7dxi2hv35mro/com/bea/wlwgen/PersistentContainer_3fq3ar_Impl.java:143:
cannot resolve symbol
symbol : class BMPContainerBean$DuplicateKeyRemoteException
location: package bean
perchance you meant 'BMPContainerBean.DuplicateKeyRemoteException'
throws
com.bea.wlw.runtime.core.bean.BMPContainerBean$DuplicateKeyRemoteException
^
1 error
This then causes other errors repeating that the deployment failed (let
me know if you need more to diagnose this):
Exception:weblogic.management.ApplicationException: prepare failed for
.workshop/myApp/EJB/myProc_1trtqtoxcz4uv
Module: .workshop/myApp/EJB/myProc_1trtqtoxcz4uv Error:
Exception preparing module:
EJBModule(.workshop/myApp/EJB/myProc_1trtqtoxcz4uv,status=NEW)
Unable to deploy EJB: .workshop/myApp/EJB/myProc_1trtqtoxcz4uv from
.workshop/myApp/EJB/myProc_1trtqtoxcz4uv:
Compiler failed executable.execBut by default WLS8.1 comes with jdk141_02 ...correct ?
AND what i understand is that...the bug you posted is related to a bug in jdk1.4.2
....correct ??
correct me if i wrong.
-sangita
Steven Ostrowski <[email protected]> wrote:
It looks like this is a bug in the BEA-generated code that is then
compiled by WLS. The generated code was using the Class1$Class2 notation
to reference the class, but since $ is a valid character in the class
name, this does not behave as intended. This used to be a bug in
pre-1.4.2 but is now fixed in 1.4.2 (look at bug 4635044, and this is
also mentioned in the 1.4.2 release notes and the Java Developer forums).
The generated code should be:
com.bea.wlw.runtime.core.bean.BMPContainerBean.DuplicateKeyRemoteException
not
com.bea.wlw.runtime.core.bean.BMPContainerBean$DuplicateKeyRemoteException
Thanks again for the good response. I'll send this in to BEA support.
Steven Ostrowski wrote:
One other thing to add, this was fixed by changing the JAVA_HOME
variable inside of the startWeblogic.sh script. Setting it in workshop
did not change anything.
Steven Ostrowski wrote:
Wow, you hit it right on target! I was using 1.4.2 then tried it on
1.4.1_03 and it deployed fine.
Is this a bug in BEA or in the JDK? In either case, where should I
report this bug?
Thanks again
Rob Woollen wrote:
What version of the JDK are you using? I believe they changed the
inner class naming conventions in 1.4.2, and it's breaking lots of
people.
-- Rob
Steven Ostrowski wrote:
Hello, I'm having trouble diagnosing the following deployment
failure. What are some common causes of this? My server was created
using an Express Integration domain with some custom JMS
destinations added afterwards via the console. I am deploying an
application built with Workshop (straight from workshop). I copied
over an application from Windows to Solaris, deleted the .workshop
directory and .beabuild.txt and rebuilt the application to deploy.
I get this error a few times.
####<Aug 21, 2003 10:48:19 AM EDT> <Info> <EJB> <rhino> <cgServer>
<ExecuteThread: '1' for queue: 'weblogic.kernel.System'> <<WLS
Kernel>> <> <BEA-012033> <Compiling generated EJB classes produced
the following Java compiler output:
/export/data/ident/bea/user_projects/domains/ident1Server.conf/./cgServer/.wlnotdelete/EJBCompilerCache/-7dxi2hv35mro/com/bea/wlwgen/PersistentContainer_3fq3ar_Impl.java:143:
cannot resolve symbol
symbol : class BMPContainerBean$DuplicateKeyRemoteException
location: package bean
perchance you meant 'BMPContainerBean.DuplicateKeyRemoteException'
throws
com.bea.wlw.runtime.core.bean.BMPContainerBean$DuplicateKeyRemoteException
^
1 error
This then causes other errors repeating that the deployment failed
(let me know if you need more to diagnose this):
Exception:weblogic.management.ApplicationException: prepare failed
for .workshop/myApp/EJB/myProc_1trtqtoxcz4uv
Module: .workshop/myApp/EJB/myProc_1trtqtoxcz4uv Error:
Exception preparing module:
EJBModule(.workshop/myApp/EJB/myProc_1trtqtoxcz4uv,status=NEW)
Unable to deploy EJB: .workshop/myApp/EJB/myProc_1trtqtoxcz4uv from
.workshop/myApp/EJB/myProc_1trtqtoxcz4uv:
Compiler failed executable.exec -
Cannot resolve symbol dropdown1 from the tutorial
Has anyone a clue to why javac won't compile the button action. I looks like it can't find the dropdown1 droplist despite the fact that it is visible in the gui editor.
here is my offending code:
String name=(String)dropdown1.getValue();
And the error code:
untitled\Page1.java [76] cannot resolve symbol
symbol : variable dropdown1
location: class untitled.Page1
String name=(String)dropdown1.getValue();Sounds like a bug.
I'm sure the engineering team would love to have some more info on this. Can you file a bug here:
http://developers.sun.com/prodtech/javatools/jscreator/bugreport.jsp
From my experience, they are taken very seriously and if it's already filed and has workaround, it'll be sent to you.
For sending the source code, I'm simply meant pasting it into the message box (using eventually formatting (see "code" button).
thanks,
-Alexis -
Class error - cannot resolve symbol "MyDocumentListener"
Hello,
this is a groaner I'm sure, but I don't see the problem.
Newbie-itis probably ...
I'm not concerned with what the class does, but it would be nice for the silly thing to compile!
What the heck am I missing for "MyDocumentListener" ?
C:\divelog>javac -classpath C:\ CenterPanel.java
CenterPanel.java:53: cannot resolve symbol
symbol : class MyDocumentListener
location: class divelog.CenterPanel
MyDocumentListener myDocumentListener = new MyDocumentListener(); // define the listener class
^
CenterPanel.java:53: cannot resolve symbol
symbol : class MyDocumentListener
location: class divelog.CenterPanel
MyDocumentListener myDocumentListener = new MyDocumentListener(); // define the listener class
^
2 errors
package divelog;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.lang.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.filechooser.*;
import javax.swing.text.*;
public class CenterPanel extends JPanel implements ActionListener
{ // Opens class
static private final String newline = "\n";
private JTextArea comments;
private JScrollPane scrollpane;
private JButton saveButton, openButton;
private JLabel whiteshark;
private Box box;
private BufferedReader br ;
private String str;
private JTextArea instruct;
private File defaultDirectory = new File("C://divelog");
private File fileDirectory = null;
private File currentFile= null;
public CenterPanel()
{ // open constructor CenterPanel
setBackground(Color.white);
comments = new JTextArea("Enter comments, such as " +
"location, water conditions, sea life you observed," +
" and problems you may have encountered.", 15, 10);
comments.setLineWrap(true);
comments.setWrapStyleWord(true);
comments.setEditable(true);
comments.setFont(new Font("Times-Roman", Font.PLAIN, 14));
// add a document listener for changes to the text,
// query before opening a new file to decide if we need to save changes.
MyDocumentListener myDocumentListener = new MyDocumentListener(); // define the listener class
comments.getDocument().addDocumentListener(myDocumentListener); // create the reference for the class
// ------ Document listener class -----------
class MyDocumentListener implements DocumentListener {
public void insertUpdate(DocumentEvent e) {
Calculate(e);
public void removeUpdate(DocumentEvent e) {
Calculate(e);
public void changedUpdate(DocumentEvent e) {
private void Calculate(DocumentEvent e) {
// do something here
scrollpane = new JScrollPane(comments);
scrollpane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
saveButton = new JButton("Save Comments", new ImageIcon("images/Save16.gif"));
saveButton.addActionListener( this );
saveButton.setToolTipText("Click this button to save the current file.");
openButton = new JButton("Open File...", new ImageIcon("images/Open16.gif"));
openButton.addActionListener( this );
openButton.setToolTipText("Click this button to open a file.");
whiteshark = new JLabel("", new ImageIcon("images/gwhite.gif"), JLabel.CENTER);
Box boxH;
boxH = Box.createHorizontalBox();
boxH.add(openButton);
boxH.add(Box.createHorizontalStrut(15));
boxH.add(saveButton);
box = Box.createVerticalBox();
box.add(scrollpane);
box.add(Box.createVerticalStrut(10));
box.add(boxH);
box.add(Box.createVerticalStrut(15));
box.add(whiteshark);
add(box);
} // closes constructor CenterPanel
public void actionPerformed( ActionEvent evt )
{ // open method actionPerformed
JFileChooser jfc = new JFileChooser();
// these do not work !!
// -- set the file types to view --
// ExtensionFileFilter filter = new ExtensionFileFilter();
// FileFilter filter = new FileFilter();
//filter.addExtension("java");
//filter.addExtension("txt");
//filter.setDescription("Text & Java Files");
//jfc.setFileFilter(filter);
//Add a custom file filter and disable the default "Accept All" file filter.
jfc.addChoosableFileFilter(new JTFilter());
jfc.setAcceptAllFileFilterUsed(false);
// -- open the default directory --
// public void setCurrentDirectory(File dir)
// jfc.setCurrentDirectory(new File("C://divelog"));
jfc.setCurrentDirectory(defaultDirectory);
jfc.setSize(400, 300);
jfc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
Container parent = saveButton.getParent();
//========================= Test Button Actions ================================
//========================= Open Button ================================
if (evt.getSource() == openButton)
int choice = jfc.showOpenDialog(CenterPanel.this);
File file = jfc.getSelectedFile();
/* a: */
if (file != null && choice == JFileChooser.APPROVE_OPTION)
String filename = jfc.getSelectedFile().getAbsolutePath();
// -- compare the currentFile to the file chosen, alert of loosing any changes to currentFile --
// If (currentFile != filename)
// -- get the current directory name -------
// public File getCurrentDirectory( );
File f=new File(System.getProperty("user.dir"));
fileDirectory = jfc.getCurrentDirectory();
// -- remember the last directory used --
if (defaultDirectory != fileDirectory)
{defaultDirectory = fileDirectory;}
try
{ //opens try
comments.getLineCount( );
// -- clear the old data before importing the new file --
comments.selectAll();
comments.replaceSelection("");
// -- get the new data ---
br = new BufferedReader (new FileReader(file));
while ((str = br.readLine()) != null)
{//opens while
comments.append(str);
} //closes while
} // close try
catch (IOException ioe)
{ // open catch
comments.append(newline +"Open command not successful:" + ioe + newline);
} // close catch
// ---- display the values of the directory variables -----------------------
comments.append(
newline + "The f directory variable contains: " + f +
newline + "The fileDirectory variable contains: " + fileDirectory +
newline + "The defaultDirectory variable contains: " + defaultDirectory );
else
comments.append("Open command cancelled by user." + newline);
} //close if statement /* a: */
//========================= Save Button ================================
} else if (evt.getSource() == saveButton)
int choice = jfc.showSaveDialog(CenterPanel.this);
if (choice == JFileChooser.APPROVE_OPTION)
File fileName = jfc.getSelectedFile();
// -- get the current directory name -------
// public File getCurrentDirectory( );
File f=new File(System.getProperty("user.dir"));
fileDirectory = jfc.getCurrentDirectory();
// -- remember the last directory used --
if (defaultDirectory != fileDirectory)
{defaultDirectory = fileDirectory;}
//check for existing files. Warn users & ask if they want to overwrite
for(int i = 0; i < fileName.length(); i ++) {
File tmp = null;
tmp = (fileName);
if (tmp.exists()) // display pop-up alert
//public static int showConfirmDialog( Component parentComponent,
// Object message,
// String title,
// int optionType,
// int messageType,
// Icon icon);
int confirm = JOptionPane.showConfirmDialog(null,
fileName + " already exists on " + fileDirectory
+ "\n \nContinue?", // msg
"Warning! Overwrite File!", // title
JOptionPane.OK_CANCEL_OPTION, // buttons displayed
// JOptionPane.ERROR_MESSAGE
// JOptionPane.INFORMATION_MESSAGE
// JOptionPane.PLAIN_MESSAGE
// JOptionPane.QUESTION_MESSAGE
JOptionPane.WARNING_MESSAGE,
null);
if (confirm != JOptionPane.YES_OPTION)
{ //user cancels the file overwrite.
try {
jfc.cancelSelection();
break;
catch(Exception e) {}
// ----- Save the file if everything is OK ----------------------------
try
{ // opens try
BufferedWriter bw = new BufferedWriter(new FileWriter(fileName));
bw.write(comments.getText());
bw.flush();
bw.close();
comments.append( newline + newline + "Saving: " + fileName.getName() + "." + newline);
break;
} // closes try
catch (IOException ioe)
{ // open catch
comments.append(newline +"Save command unsuccessful:" + ioe + newline);
} // close catch
} // if exists
} //close for loop
else
comments.append("Save command cancelled by user." + newline);
} // end-if save button
} // close method actionPerformed
} //close constructor CenterPanel
} // Closes class CenterPanelThere is no way to be able to see MyDocumentListener class in the way you wrote. The reason is because MyDocumentListener class inside the constructor itself. MyDocumentListener class is an inner class, not suppose to be inside a constructor or a method. What you need to do is simple thing, just move it from inside the constructor and place it between two methods.
that's all folks
Qusay -
Try/catch and 'cannot resolve symbol'
I am relatively new to java programming and something has me puzzled...
Why do I get a 'cannot resolve symbol' message when I include a variable definition in a try/catch section. When I put it/them before the 'try' statement it compiles as expected. How are statements inside a try compiled differently than those outside?
try {
StringBuffer pageBuffer = new StringBuffer();
String inputLine;
BufferedReader in = new BufferedReader(
new InputStreamReader( theURL.openStream() ) );
while ((inputLine = in.readLine()) != null) {
System.out.println(inputLine);
pageBuffer.append(inputLine);
in.close();
} catch (Exception ignored) {}C:\Projects\WebExplorer\PageVisitor.java:142: cannot resolve symbol
symbol : variable pageBuffer
location: class PageVisitor
return pageBuffer.toString();
PaulA try block is just like any other block delimited by {...} in that all variables declared inside it are local to that block. I.e. they are not visible or usable anywhere outside it. Your pageBuffer variable, for example, is a local variable that can only be used inside the try-block in which it is declared.
Your obvious solution, knowing that, is to declare the variables outside the try and catch blocks. Remember to initialize them (even to null), otherwise the compiler will complain about variables that may not have been initialized. -
Cannot cast java.io.serialiazable to int Error
Dear Members,
I have procedure in AM which is as follows:
public int countRecs(String headerID)
int count=0;
count= integer value assigned from SQL Query*
return count;
I am calling this procedure from the CO of the page as follows:
String headerID="123"
int count=0;
*Serialiazable para[]={headerID};*
count=(int)am.invokeMethod("countRecs",headerID);
When I am compiling my CO I am getting the below error:
Cannot cast java.io.serialiazable to int
Kindly please help me in resolving this error.
Many thanks in advance.
Best Regards,
Arun Reddy D.the signature of the method you are invoking is
public Serializable invokeMethod(String methodName,
Serializable[] methodParams)
so the return type is also serializable. so you should change your method signature accordingly
public int countRecs(String headerID)
int count=0;
count= integer value assigned from SQL Query*
return count;
public String countRecs(String headerID)
//just change last statement
return ""+count;}
your CO call should be
count=(int)am.invokeMethod("countRecs",headerID);count = Integer.parseInt(am.invokeMethod("countRecs",para));
so finally your count variable will hold an integer
you may need to keep the above statement in try catch block
Regards
Ravi
Maybe you are looking for
-
I've had my nano 4g for about a month and a half. Its been working fine until yesterday. After use, I connected it to my laptop for recharging and adding songs, but Itunes did not recognize it. It is present in "Mycomputer" and launches Itunes but is
-
Hi , I am using Direct input program to update and change material master by using program RMDATIND.I have to update MRP,Purchasing,Storage,work scheduling,QM views and changing sales,plant views.I didnt find the fields belongs to QM view in the
-
My itunes is deleting my library extras and genius.
Ever since I downloaded the new version of itunes, I keep loosing all my music. I download it again and as soon as I close itunes it throws my library extras an library genius in the trash and I have to start all over. I have an ipad and iphones and
-
How do I install 32 bit gcc on a OEL 5.8 64 bit system
Hi, How do I install 32 bit gcc on a OEL 5.8 64 bit system the command to check whether the required versions of the 32-bit and 64-bit glibc packages are installed is as follows: rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE}-%{ARCH}\n' packagename while
-
Can I use Itune music on you tube?
I am wanting to put some music with my video's on you tube but the rules have confused me a bit, is copywrite a problem?