Cannot Resolve Symbol - What is this???
I am getting this message when trying to build an Array and don't see why my variable " i " will not work here. The code looks like this:
double firstArray[] = new double[count];
// if user enters 0, process this way.
if (count == 0)
count = (count > 15 ? 15 : count);
for(int i = 0; i < count; i++)
numIn = JOptionPane.showInputDialog("Enter Number " +(i + 1) ".");
try
firstArray(i) = Double.parseDouble(numIn);
}// end try.
catch(NumberFormatException e)
System.out.println("You entered a non-number!" + e);
--i;
}// end catch.
Please help....
Thank you,
Brian McCaslin
i is out of scope in the try/catch blocks..it's only in scope for the one line in your for loop.. try declaring outside the for loop...
Similar Messages
-
"Cannot resolve symbol" -- what does this mean?
D:\maUni\0203\COMPSC~1\ASSIGN~1\ASSIGN~3\q1\ExceptionTest.java:38: cannot resolv
e symbol
symbol : class TooBigToBeShortException
location: class ExceptionTest
public static short shorten(int large) throws TooBigToBeShortException {
^
D:\maUni\0203\COMPSC~1\ASSIGN~1\ASSIGN~3\q1\ExceptionTest.java:28: cannot resolv
e symbol
symbol : class TooBigToBeShortException
location: class ExceptionTest
catch (TooBigToBeShortException e){
^
2 errors
D:\JEDPlus>
Can anyone please explain what this Error means?
thanksi am most definitely NOT doing down self-teachers (see further down!)... I have the utmost respect to those who have taught themselves complex things successfully and can make a living out of it (I don't think I would have been able to teach myself java froms scratch!)... that's fair play in the job market as far as I am concerned!
Self-teaching and carpet-bagging are 2 totally different things... I am talking about the latter! Maybe I am too quick to assume everyone is a clueless money grabber, but its just the state of the market - fact is it wouldn't be like this if all those who are not truly into IT for what it is had all jumped on another bandwagon (maybe pyramid selling... or buy to rent property), but thats immaterial now anyway.
As far as only being cool if you forge ahead solo - I wouldn't expect anyone to learn anything in isolation. I am a regular forum contributor, but my pet hate is people who don't do their bit first. Maybe its just my old school work ethic, but I think there should be a substantial element of self-teaching in anything you might choose to learn. Books, Library, tutorials, google, forum archives etc etc are information resources that will answer 100% of your questions (if you know where to look!), and you will have the satisfaction of having sorted it alone. BUT if you have tried all of these, and failed then thats ok - you have done your bit!! Thats when the forums come into their own, and any question that emerges like this will be welcomed. I am not being judgemental about 'good' or 'bad' questions (there are no such things) but its just that this is kind of how the forums are meant to be used, in my opinion.
Maybe I am just too traditional, but it does annoy me when I see the same questions asked over and over (CLASSPATH springs to mind) when the answers are not even difficult to find, as they are all here ad nauseum in the forums! Thats when I tend to get sarcastic, and it gets misconstrued as being unhelpful to newbies. It's just exasperating to see people who don't have strongly internalised values about education, learning and working.
OP, if I have you wrong then I am truly sorry, you just exhibited 'the traits' for a second back there... -
Visual Studio 2012 cannot resolve symbol or Errors control is not a member of class
Visual Studio 2012 Web Site Project (Note not a Web application, so there are not Designer.vb files) > Site works perfectly fine and using IIS and attaching to IIS to debug code.
However, if I try to build the site inside of Visual Studio I am getting lots of Errors ‘pnlName’ is not a member of ‘Page_Name’ In the code behind I am getting errors ‘Cannot resolve symbol ‘pnlName’
.ascx Page
<li style="margin-right:0;" id="pnlName" runat="server"><a href="/cart" title="Checkout" class="global-checkout">Checkout</a></li>
.ascx.vb page
Me.pnlName.Attributes.Remove("style")
I have cleaned, rebuild and nothing gets rid of these errors, but again the site works as designed, but I would like to launch and debug inside of Visual Studio.
Moojjoo MCP, MCTS
MCP Virtual Business Card
http://moojjoo.blogspot.comCor,
What I am stating is this is a solution using the Web Site Project instead of a
Web Application Project.
Web Site projects do not require Designer.vb files, Web Application Projects add Designer.vb files in the solution.
Background: I have been hired to support a very successful e-commerce site that was built by a 3rd party vendor (I had no input on the contract or specification, because I would have went with
MVC). The site works 100% correctly, however from my 2003 - 2015 experience with Visual Studio and Web Development being in Web Forms and MVC I have always built ASP.NET Solutions using the Web Application Project Templates, which compiles the code down
to .dlls.
A Web Site project does not compile the code, but simply uses the .vb files and they have to be migrated to the server with the .aspx files. http://msdn.microsoft.com/en-us/library/dd547590%28v=vs.110%29.aspx
Currently the only way I can debug this Solution is to attach to the w3wp.exe process running locally on my work station.
The Solution is comprised of two Web Sites, which I cannot get it to compile because of the following errors -
'webServerControlName' is not a member of '(Protected Code Behind Class Name)' I am reaching out to the MSDN community to see if anyone has experienced this issue with
Web Site Projects.
I hope that clears up the Project Type question.
Moojjoo MCP, MCTS
MCP Virtual Business Card
http://moojjoo.blogspot.com -
Missing method body and cannot resolve symbol
I keep getting these two errors when trying to compile. I know that I need to call my fibonacci and factorial functions from the main function. Is this why I am getting the missing method body error? How do I correct this?
Am I getting the cannot resolve symbol because I have to set the num and fact to equal something?
Thanks
public class Firstassignment
public static void main(String[]args)
System.out.println();
public static void fibonacci(String[]args);
int even=1;
int odd=1;
while (odd<=100);
System.out.println(even);
int temp = even;
even = odd;
odd = odd + temp;
public static void factorial (String[]args);
for (int count=1;
count<=num;
count++);
fact = fact * count;
outputbox.printLine("Factorial of" + num + "is" + fact);Hey... :o)
the problem is that you've put semicolons at the end of the function signature, like this:
public static void fibonacci(String[]args);
}that should happen only when the function is abstract... so ur function should actually look like this:
public static void fibonacci(String[]args)
}also, i think you've missed out on the declarations (like what are fact and num??).... -
"cannot resolve symbol" in a Timer !!!Please Help!!!
I am doing a program for a class which involves timers. I am using JCreator and when i try to construct a new timer, the compiler points to the "new" in the line:
Timer T1=new Timer(interval, ActionListener);
^
This is what it looks like and the error reads: cannot resolve symbol; constructor Timer.
please tell me if yiou have any information or suggestions as to how this error might be remedied.Sure, here it is:
import java.awt.event.*;
import javax.swing.Timer;
import javax.swing.JOptionPane;
import java.util.*;
interface ActionListener
void actionPerformed(ActionEvent event);
class Ploid
public static void main(String[] args)
class Car implements ActionListener
int mpg=30;
int mph=35;
int gtank=20;
int interval;
int changer;
int totalmiles;
Car(int x)
interval=x;
public void actionPerformed(ActionEvent event)
for(int c=0;c<(interval/1000);c++)
totalmiles=totalmiles+mph;
int hyt=mpg*gtank;
if(totalmiles>hyt)
int y=totalmiles-hyt;
totalmiles=totalmiles-y;
System.out.println(totalmiles);
else
System.out.println(totalmiles);
class SUV implements ActionListener
int mpg=15;
int mph=55;
int gtank=30;
int interval;
int changer;
int totalmiles;
SUV(int x)
interval=x;
public void actionPerformed(ActionEvent event)
for(int c=0;c<(interval/1000);c++)
totalmiles=totalmiles+mph;
int hyt=mpg*gtank;
if(totalmiles>hyt)
int y=totalmiles-hyt;
totalmiles=totalmiles-y;
System.out.println(totalmiles);
else
System.out.println(totalmiles);
class Semi implements ActionListener
int mpg=60;
int mph=80;
int gtank=50;
int interval;
int changer;
int totalmiles;
Semi(int x)
interval=x;
public void actionPerformed(ActionEvent event)
for(int c=0;c<(interval/1000);c++)
totalmiles=totalmiles+mph;
int hyt=mpg*gtank;
if(totalmiles>hyt)
int y=totalmiles-hyt;
totalmiles=totalmiles-y;
System.out.println(totalmiles);
else
System.out.println(totalmiles);
String flag="y";
String trav=JOptionPane.showInputDialog("How long do you want to drive?(1000=1 hour)");
int t1=Integer.parseInt(trav);
Car listen=new Car(t1);
SUV listener2=new SUV(t1);
Semi listener3=new Semi(t1);
final int t2=t1/1000;
final int t3=t1/t2;
ActionListener listener=null;
Timer T1=new Timer(t3, listener);
Timer T2=new Timer(t3, listener);
Timer T3=new Timer(t3, listener);
while(flag.equals("y"))
T1.start();
T2.start();
T3.start();
String g=JOptionPane.showInputDialog("Do you want to drive again?");
if((g.equals("y"))||(g.equals("Y")))
System.out.println("Let's Drive!");
else
flag=g;
System.exit(0);
}Here is the errors:
[errors]
A:\Ploid2.java:116: cannot resolve symbol
symbol : constructor Timer (int,ActionListener)
location: class javax.swing.Timer
Timer T1=new Timer(t3, listener);
^
A:\Ploid2.java:117: cannot resolve symbol
symbol : constructor Timer (int,ActionListener)
location: class javax.swing.Timer
Timer T2=new Timer(t3, listener);
^
A:\Ploid2.java:118: cannot resolve symbol
symbol : constructor Timer (int,ActionListener)
location: class javax.swing.Timer
Timer T3=new Timer(t3, listener);
^
3 errors
Process completed.
[errors]
****There is the source code and the errors the compiler returns. That should be more help.**** -
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 -
Cannot resolve symbol class graphics
does anyone know what the error
cannot resolve symbol class graphics means?
with this code i can't seem to call the graphics method to draw the line....any reason why?
import javax.swing.*;
import java.*;
public class LineDraw extends JFrame {
public static void main(String[] args) {
LineDraw ld = new LineDraw();
ld.setSize(500,500);
ld.setVisible(true);
ld.enterVariables();
public void init(){
private int x1;
private int x2;
private int y1;
private int y2;
public void paint(Graphics g) {
g.GetGraphics(g);
super.paintComponent(g);
g.drawLine(x1, y1, x2, y2);
public void enterVariables() {
x1 = Integer.parseInt(JOptionPane.showInputDialog("Enter x1:"));
y1 = Integer.parseInt(JOptionPane.showInputDialog("Enter y1:"));
x2 = Integer.parseInt(JOptionPane.showInputDialog("Enter x2:"));
y2 = Integer.parseInt(JOptionPane.showInputDialog("Enter y2:"));
repaint();
}well the exact error message is ...by the way now that i think about it
if the graphics method shoudl not be part of the JFrame class then what method would i use to draw 2D Graphics?
--------------------Configuration: <Default>--------------------
C:\Documents and Settings\c1s5\My Documents\LineDraw.java:21: cannot resolve symbol
symbol : class Graphics
location: class LineDraw
public void paint(Graphics g)
^
1 error
Process completed.
and the exact code is
import javax.swing.*;
import java.*;
public class LineDraw extends JFrame {
public static void main(String[] args) {
LineDraw ld = new LineDraw();
ld.setSize(1024,500);
ld.setVisible(true);
ld.enterVariables();
private int x1;
private int x2;
private int y1;
private int y2;
public void paint(Graphics g)
super.paintComponent(g);
g.drawLine(x1, y1, x2, y2);
public void enterVariables() {
x1 = Integer.parseInt(JOptionPane.showInputDialog("Enter x1:"));
y1 = Integer.parseInt(JOptionPane.showInputDialog("Enter y1:"));
x2 = Integer.parseInt(JOptionPane.showInputDialog("Enter x2:"));
y2 = Integer.parseInt(JOptionPane.showInputDialog("Enter y2:"));
repaint();
} -
Cannot resolve symbol error even with class imported
Hi
I'm trying to print out a java.version system property but keep getting a
cannot resolve symbol error
symbol: class getProperty
location: class java.lang.System
I've looked at the API and getProperty() is a method of lang.System
Can anyone throw any light?
thanks
import java.lang.System;
class PropertiesTest {
public static void main(String[] args) {
String v = new System.getProperty("java.version");
System.out.println(v);
}Thanks Jos
It compiles but I now get a runtime error
Exception in thread "main"
java.lang.NoClassDefFoundError:PropertiesTest
What do you reckon is the problem?
thanks
java -cp .;<any other directories or jars>
YourClassNameYou get a NoClassDefFoundError message because the
JVM (Java Virtual Machine) can't find your class. The
way to remedy this is to ensure that your class is
included in the classpath. The example assumes that
you are in the same directory as the class you're
trying to run.I know it's a bad habit but I've put this file (PropertiesTest.java) and the compiled class (PropertiesTest.class) both in my bin folder which contains the javac compiler -
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 -
BufferedReader cannot resolve symbol
Hi,
I need some help with a java program which reads xml files to a specified location, running it on a UNIX machine using Java 1.4.1. I modified the code to include the BufferedReader class, but it keeps complaining about not being able to resolve symbol at line 50 & 53. Any help here would be appreciated, since I'm a newbie.
bash-2.05$ javac outputScript.java
outputScript.java:50: cannot resolve symbol
symbol : constructor InputStreamReader (java.lang.String)
location: class java.io.InputStreamReader
BufferedReader in = new BufferedReader(new InputStreamReader("in"));
^
outputScript.java:53: cannot resolve symbol
symbol : method available ()
location: class java.io.BufferedReader
while (in.available() !=0)
Here's the code:
//package cognos8_3;
import java.io.*;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.File;
* outputScript.java
* Copyright Cognos Incorporated. All Rights Reserved.
* Cognos and the Cognos logo are trademarks of Cognos Incorporated.
* Description: (KB 1013700) - Sample script that will rename output files generated by CM.OUTPUTLOCATION - Cognos 8.3
class outputScript
public static void main(String args[])
String reportName = "";
String reportViewName = "";
String outputLocation = "/data/cognos/rn_filecp/";
String defName = "";
String ofTime = "";
String burstKey = "";
int countRenamed = 0;
// get the list of desc files in the outputlocation
File descFiles = new File(outputLocation);
String[] children = descFiles.list();
if (children == null || children.length == 0)
System.out.println("Invalid file location or no reports found to rename.");
else
System.out.println("Found " + children.length + " files in this location, search for file names containing '_desc.'.");
for (int i=0; i<children.length; i++)
try
// Get filename of file or directory
String filename = children;
if (filename.indexOf("_desc.")>=0)
// Open the file that is the first
// command line parameter
FileInputStream fstream = new FileInputStream(outputLocation+filename);
FileInputStream bis = new FileInputStream(fstream);
BufferedReader in = new BufferedReader(new InputStreamReader("bis.in"));
// Continue to read lines while there are still some left to read
while (in.available() !=0)
String temp = in.readLine();
System.out.println(temp);
// check for report name
if (temp.indexOf("report[@name=")>0)
// get beginning of name
int startIndex = temp.indexOf("report[@name='");
String startString;
int endIndex = 0;
if (startIndex > 0)
startString = temp.substring(startIndex);
startIndex = startString.indexOf("'") + 5; //' 6 characters
endIndex = startString.lastIndexOf("'");
else
startIndex = temp.indexOf("report[@name=");
startString = temp.substring(startIndex);
startIndex = startString.indexOf("@name=") + 6; //' 6 characters
endIndex = startString.lastIndexOf("]");
// get report name
reportName = startString.substring(startIndex+1, endIndex);
//System.out.println("Found report name - " + reportName);
else if (temp.indexOf("reportView[@name=")>0)
// get beginning of name
int startIndex = temp.indexOf("reportView[@name='");
String startString;
int endIndex = 0;
if (startIndex > 0)
startString = temp.substring(startIndex);
startIndex = startString.indexOf("'") + 5; //' 6 characters
endIndex = startString.lastIndexOf("'");
else
startIndex = temp.indexOf("reportView[@name=");
startString = temp.substring(startIndex);
startIndex = startString.indexOf("@name=") + 6; //' 6 characters
endIndex = startString.lastIndexOf("]");
// get report name
reportViewName = startString.substring(startIndex+1, endIndex);
//System.out.println("Found reportView name - " + reportViewName);
else if (temp.indexOf("</fileName>")>0) //check for default name
defName = temp.substring(temp.indexOf(">")+1, temp.lastIndexOf("<"));
else if (temp.indexOf("asOfTime")>=0) // get the time to assure uniqueness when saving
ofTime = temp.substring(temp.indexOf(">")+1, temp.lastIndexOf("<"));
// clean colons from time
ofTime = ofTime.replaceAll(":","_");
else if (temp.indexOf("</burstKey>")>=0)
burstKey = temp.substring(temp.indexOf(">")+1, temp.lastIndexOf("<"));
in.close();
if (reportName.length() == 0)
reportName = reportViewName;
//System.out.println("Renaming using view name - no report name found");
String format = defName.substring(defName.length()-3, defName.length());
// new description xml file
File file = new File(outputLocation+filename);
File newDescFile = new File(outputLocation + reportName+"_"+burstKey+"_"+ofTime+"DESC_" + format+ ".xml");
// new renamed specific format file.
File file3 = new File(outputLocation+defName);
File newDefFile = new File(outputLocation + reportName+"_"+burstKey+"_"+ofTime+"."+format);
boolean success = file3.renameTo(newDefFile);
if (!success)
// File was not successfully renamed
System.out.println("ERROR attempting to rename - " + file3.getAbsolutePath() + " to \n\t\t" +
newDefFile.getAbsolutePath());
else
countRenamed++;
// File was successfully renamed
System.out.println(countRenamed +") Renamed - " + file3.getAbsolutePath() + " to \n\t\t" +
newDefFile.getAbsolutePath());
// Rename file (or directory)
success = file.renameTo(newDescFile);
if (!success)
// File was not successfully renamed
System.out.println("ERROR attempting to rename - " + file.getAbsolutePath() + " to \n\t\t" +
newDescFile.getAbsolutePath());
else
// File was successfully renamed
System.out.println(" - " + file.getAbsolutePath() + " to \n\t\t" +
newDescFile.getAbsolutePath());
catch (Exception e)
System.err.println("File input error " + e.getMessage()) ;
System.out.println("Complete.");
Thanks,
Nick
Edited by: nickmills on Aug 31, 2008 5:05 PMFirst, you only need to create the FileInputStream once. Then that's what you pass to the InputStreamReader constructor. Your code for reading from the BufferedReader is also wrong.FileInputStream fstream = new FileInputStream(outputLocation+filename);
// FileInputStream bis = new FileInputStream(fstream); <-- remove this line
BufferedReader in = new BufferedReader(new InputStreamReader(fstream));
// available() doesn't do what you think it does; forget about it.
// Here's the standard way to use a BufferedReader
String line = null;
while ((line = in.readLine()) != null)
// process 'line'
} There are probably other errors in the code, but reading all that unformatted code is too much of a hassle. In future, please use {code} tags when posting source code. -
Factory method generateRandomCircle: "cannot resolve symbol"
I have written 2 classes: Point and Circle, which uses Point objects in order to create a Circle object. I have created a factory method for Point, which creates random Point objects and a for Circle, which does the same. "newRandomInstance" works fine for Point, but "generateRandomCircle" throws a "cannot resolve symbol" error. "main" is inside Point class. What's the problem?
Thanks
================================================
import java.io.*;
import java.lang.*;
import java.util.*;
public class Circle implements Cloneable
public static Circle generateRandomCircle()
int a= (int) (Math.random()* Short.MAX_VALUE);
int b= (int) (Math.random()* Short.MAX_VALUE);
Point p=new Point(a,b);
int r= (int) (Math.random()* Short.MAX_VALUE);
Circle c= new Circle(p,r);
return c;
===============================================
import java.io.*;
import java.lang.*;
import java.util.*;
public class Point implements Cloneable, Comparable
public static Point newRandomInstance()
int x = (int) (Math.random() * Short.MAX_VALUE);
int y = (int) (Math.random() * Short.MAX_VALUE);
return new Point(x,y);
public static void main (String[] args)
Circle cRandom= generateRandomCircle(); //doesn't work
System.out.println(cRandom.getCenter()+" "+ cRandom.getRadius());
Point randomP= newRandomInstance(); //works OK
randomP.printPoint();
}I tried "Circle cRandom=
Circle.generateRandomCircle(); " instead of "Circle
cRandom= generateRandomCircle();" and it worked. Why
did this happen?Because generateRandomCircle() exists in class Circle and not in class Point where your are trying to use it.
>
Function "newRandomInstance()" works either as
"Point.newRandomInstance()" or as
"newRandomInstance()", however. Why does this
controversy exist?No controversy! Your main() is contained within class Point and as such knows about everything that is declared in class Point() but nothing about what is in class Circle unless you tell it to look in class Circle. -
Weird cannot resolve symbol error.
I'm having a problem with the most simple thing, but I really don't know what is th error, maybe I can�t see the error because the lack of rest.
I have two classes, both are in a package and in the same folder.
This is are the problematic lines.
tmpLong = calculateSizeFile("sonido.wav");
tmpInt = calculateSizeSegment("sonido.wav");
SendFile file1 = new SendFile(args[0], "sonido.wav", 2, 32, 2, 2, tmpLong, tmpInt);
The SendFile is the other class and it�s a thread.
The package decalaration is:
package com.sigmatao.gde.batch;
This is the constructor of the other class:
public SendFile(String httpServlet, String file, int numberRetry, int maxTimeWait,int multiplier,int timeMin, long sizeFileToSend, int sizeSegmentFile)
Thanks in advanced for the help.C:\Temp\URL\com\sigmatao\gde\batch>javac BatchTransfer.java
BatchTransfer.java:20: cannot resolve symbol
symbol : class SendFile
location: class com.sigmatao.gde.batch.BatchTransfer
SendFile file1 = new SendFile(args[0], "sonido.wav", 2, 32, 2, 2, tmpLon
g, tmpInt);
^
BatchTransfer.java:20: cannot resolve symbol
symbol : class SendFile
location: class com.sigmatao.gde.batch.BatchTransfer
SendFile file1 = new SendFile(args[0], "sonido.wav", 2, 32, 2, 2, tmpLon
g, tmpInt);
This is the problem. -
Error when activating - "cannot resolve symbol"
Hi everybody!
I created a WebDynpro DC referencing some other DC's, one of them containing some generated Enterprise Connector classes.
A local build works fine, the WebDynpro looks and works as expected when deployed to our J2EE server. When I activate the associated activities, all DC except the WebDynpro DC compile o.k., but the WebDynpro compilation throws some "cannot resolve symbol" errors, the symbols being the generated classes from the Enterprise Connector DC.
The Activation Log of this component shows that only one class of this DC is being compiled and packed into the public parts of the DC:
[echo] Starting Java compiler
[javac] Compiling 1 source file to /usr/sap/...somewhere.../classes
[timer] Java compilation finished in 0.375 seconds
[echo] Start XLF conversion
[timer] XLF conversion finished in 0.001 seconds
createPublicParts:
[pppacker] Packing assembly public part 'mvRFCAss'
[pppacker] Packed 0 files for entity mvRFCObjects.util (Java Package/Class, mvRFCObjects/util)
[pppacker] Packed 2 files for entity mvRFCObjects (Java Package/Class, mvRFCObjects)
[pppacker] Packed 2 entities for assembly public part 'mvRFCAss'
[timer] Packing of assembly public part 'mvRFCAss' finished in 0.059 seconds
[pppacker] Packing compilation public part 'mvRFCComp'
[pppacker] Packed 0 files for entity GeschaeftsPartnerRFC_PortType (Java Class/Class, mvRFCObjects)
[pppacker] Packed 0 files for entity Z_Ecm_Input (Java Class/Class, mvRFCObjects)
[pppacker] Packed 0 files for entity Z_Ecm_Output (Java Class/Class, mvRFCObjects)
[pppacker] Packed 0 files for entity Ztgd_EcmType (Java Class/Class, mvRFCObjects)
[pppacker] Packed 0 files for entity Ztgd_EcmType_List (Java Class/Class, mvRFCObjects/util)
[pppacker] Packed 2 files for entity MVTestSapAccess (Java Class/Class, mvRFCObjects)
[pppacker] Packed 6 entities for compilation public part 'mvRFCComp'
[timer] Packing of compilation public part 'mvRFCComp' finished in 0.095 seconds
Any hint on what produces such an error or what information you'd need so say something ?
Thanks!After messing around a bit, we finally deleted both assembly and compilation public parts of all the referenced DC's, created new ones and reestablished the references exactly as defined previously, and now it works properly. Strange thing, though...
-
Error: Cannot Resolve symbol
Hi i have written this program but it is not compling properly. i do not know what to do to sort it. here is the code:
import java.sql.*;
import java.io.DataInputStream;
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
public class Phase1 extends JFrame implements ActionListener, MouseListener
//Create Buttons and Text areas etc for the GUI itself
JButton add, current, delete, order, all, exit;
JTextField textStockCode, textStockDesc, textCurrentLevel, textReorderLevel, textPrice;
JTextArea textarea;
JScrollPane pane1;
JLabel labelStockCode, labelStockDesc, labelCurrentLevel, labelReorderLevel, labelPrice, labelTextArea;
String stockCode, stockDesc, currentLevel, reorderLevel, price;
JLabel welcome;
//Setup database connections and statements for later use
Connection db_connection;
Statement db_statement;
public Phase1()
//Display a welcome message before loading system onto the screen
JOptionPane.showMessageDialog(null, "Welcome to the Stock Control System");
//set up the GUI environment to use a grid layout
Container content=this.getContentPane();
content.setLayout(new GridLayout(3,6));
//Inititlise buttons
add=new JButton("Add");
add.addActionListener(this);
current=new JButton("Show Current Level");
current.addActionListener(this);
delete=new JButton("Delete");
delete.addActionListener(this);
order=new JButton("Place Order");
order.addActionListener(this);
all = new JButton("Show All Entries");
all.addActionListener(this);
exit = new JButton("Exit");
exit.addActionListener(this);
//Add Buttons to the layout
content.add(add);
content.add(current);
content.add(delete);
content.add(order);
content.add(all);
content.add(exit);
//Initialise text fields for inputting data to the database and
//Add mouse listeners to clear the boxs on a click event
textStockCode = new JTextField("");
textStockCode.addMouseListener(this);
textStockDesc = new JTextField("");
textStockDesc.addMouseListener(this);
textCurrentLevel = new JTextField("");
textCurrentLevel.addMouseListener(this);
textReorderLevel = new JTextField("");
textReorderLevel.addMouseListener(this);
textPrice = new JTextField("");
textPrice.addMouseListener(this);
//Initialise the labels to label the Text Fields
labelStockCode = new JLabel("Stock Code");
labelStockDesc = new JLabel("Stock Description");
labelCurrentLevel = new JLabel("Current Level");
labelReorderLevel = new JLabel("Re-Order Level");
labelPrice = new JLabel("Price");
labelTextArea = new JLabel("All Objects");
//Add Text fields and labels to the GUI
content.add(labelStockCode);
content.add(textStockCode);
content.add(labelStockDesc);
content.add(textStockDesc);
content.add(labelCurrentLevel);
content.add(textCurrentLevel);
content.add(labelReorderLevel);
content.add(textReorderLevel);
content.add(labelPrice);
content.add(textPrice);
content.add(labelTextArea);
//Create a text area with scroll bar for showing Entries in the text area
textarea=new JTextArea();
textarea.setRows(6);
pane1=new JScrollPane(textarea);
content.add(pane1);
//Try to connect to the database through ODBC
try
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
//Create a URL that identifies database
String url = "jdbc:odbc:" + "stock";
//Now attempt to create a database connection
//First parameter data source, second parameter user name, third paramater
//password, the last two paramaters may be entered as "" if no username or
//pasword is used
db_connection = DriverManager.getConnection(url, "demo","");
//Create a statement to send SQL
db_statement = db_connection.createStatement();
catch (Exception ce){} //driver not found
//action performed method for button click events
public void actionPerformed(ActionEvent ev)
if(ev.getSource()==add) //If add button clicked
try
add(); //Run add() method
catch(Exception e){}
if(ev.getSource()==current)
{ //If Show Current Level Button Clicked
try
current(); //Run current() method
catch(Exception e){}
if(ev.getSource()==delete)
{ //If Show Delete Button Clicked
try
delete(); //Run delete() method
catch(Exception e){}
if(ev.getSource()==order) //If Show Order Button Clicked
try
order(); //Run order() method
catch(Exception e){}
if(ev.getSource()==all) //If Show Show All Button Clicked
try
all(); //Run all() method
catch(Exception e){}
if(ev.getSource()==exit) //If Show Exit Button Clicked
try{
exit(); //Run exit() method
catch(Exception e){}
public void add() throws Exception //add a new stock item
stockCode = textStockCode.getText();
stockDesc = textStockDesc.getText();
currentLevel = textCurrentLevel.getText();
reorderLevel = textReorderLevel.getText();
price = textPrice.getText();
if(stockCode.equals(""))
JOptionPane.showMessageDialog(null,"Ensure Stock Code is filled out");
if(stockDesc.equals(""))
JOptionPane.showMessageDialog(null,"Ensure Description is filled out");
if(price.equals(""))
JOptionPane.showMessageDialog(null,"Ensure price is filled out");
if(currentLevel.equals(""))
JOptionPane.showMessageDialog(null,"Ensure Current Level is filled out");
if(reorderLevel.equals(""))
JOptionPane.showMessageDialog(null,"Ensure Re-Order Level is filled out");
else
//Add item to database with variables set from text fields
db_statement.executeUpdate("INSERT INTO stock VALUES
('"+stockCode+"','"+stockDesc+"','"+currentLevel+"','"+reorderLevel+"','"+price+"')");
public void current() throws Exception //check a current stock level
if(textStockCode.getText().equals(""))//if no stockcode has been entered
JOptionPane.showMessageDialog(null,"Enter a Stock Code.");
else
ResultSet resultcurrent = db_statement.executeQuery("SELECT * FROM stock WHERE StockCode = '"+textStockCode.getText()+"'");
textarea.setText("");
if(resultcurrent.next())
do
textarea.setText("Stock Code: "+resultcurrent.getString("StockCode")+"\nDescription:
"+resultcurrent.getString("StockDescription")+"\nCurrent Level: "+resultcurrent.getInt("CurrentLevel")+"\nRe-Order Level:
"+resultcurrent.getInt("ReorderLevel")+"\nPrice: "+resultcurrent.getFloat("Price"));
while(resultcurrent.next());
else
//Display Current Stock Item (selected from StockCode Text field in the scrollable text area
JOptionPane.showMessageDialog(null,"Not a valid Stock Code");
public void delete() throws Exception //delete a current stock item
if(textStockCode.getText().equals("")) //Check there is a stock code entered
JOptionPane.showMessageDialog(null,"Enter a Stock Code.");
else
//Delete Item from database where Stock Code is what is in Stock Code Text Field
db_statement.executeUpdate("DELETE * FROM stock WHERE StockCode='"+textStockCode.getText()+"'");
public void order() throws Exception //check price for an order
if(textStockCode.getText().equals("")) //Check there is a stock code entered
JOptionPane.showMessageDialog(null,"Enter a Stock Code.");
else
//Set some variables to aid ordering
float price = 0;
int currentlevel = 0;
int newlevel = 0;
int reorder = 0;
String StockCode = textStockCode.getText();
//Post a message asking how many to order
String str_quantity = JOptionPane.showInputDialog(null,"Enter Quantity: ","Adder",JOptionPane.PLAIN_MESSAGE);
int quantity = Integer.parseInt(str_quantity);
//Get details from database for current item
ResultSet resultorder = db_statement.executeQuery("SELECT * FROM stock WHERE StockCode='"+StockCode+"'");
//Set variables from database to aid ordering
while (resultorder.next())
price = resultorder.getFloat("Price");
currentlevel = (resultorder.getInt("CurrentLevel"));
reorder = (resultorder.getInt("ReorderLevel"));
//Set the new level to update the database
newlevel = currentlevel - quantity;
//calculate the total price of the order
float total = price * quantity;
//If the stock quantity is 0
if(quantity == 0)
//Display a message saying there are none left in stock
JOptionPane.showMessageDialog(null,"No Stock left for this item");
//Otherwise check that the quantity ordered is more than what is lewft in stock
else if(quantity > currentlevel)
//If ordered too many display a message saying so
JOptionPane.showMessageDialog(null,"Not enough in stock, order less");
else
//Otherwise Display the total in a message box
JOptionPane.showMessageDialog(null,"Total is: "+total);
//then update the database with new values
db_statement.executeUpdate("UPDATE Stock SET CurrentLevel="+newlevel+" WHERE StockCode='"+StockCode+"'");
//Check if the new level is 0
if(newlevel == 0)
//If new level IS 0, send a message to screen saying so
JOptionPane.showMessageDialog(null,"There is now no Stock left.");
else
//otherwise if the newlevel of stock is the same as the reorder level
if(newlevel == reorder)
// display a message to say so
JOptionPane.showMessageDialog(null,"You are now at the re-order level, Get some more of this item in
stock.");
//Otherwise if the new level is lower than the reorder level,
if(newlevel < reorder)
//Display a message saying new level is below reorder level so get some more stock
JOptionPane.showMessageDialog(null,"You are now below the reorder level. Get some more of this item in
stock.");
public void all() throws Exception //show all stock items and details
//Get everthing from the database
ResultSet resultall = db_statement.executeQuery("SELECT * FROM Stock");
textarea.setText("");
while (resultall.next())
//Display all items of stock in the Text Area one after the other
textarea.setText(textarea.getText()+"Stock Code: "+resultall.getString("StockCode")+"\nDescription:
"+resultall.getString("StockDescription")+"\nCurrent Level: "+resultall.getInt("CurrentLevel")+"\nRe-Order Level:
"+resultall.getInt("ReorderLevel")+"\nPrice: "+resultall.getFloat("Price")+"\n\n");
public void exit() throws Exception //exit
//Cause the system to close the window, exiting.
db_connection.commit();
db_connection.close();
System.exit(0);
public static void main(String args[])
//Initialise a frame
JDBCFrame win=new JDBCFrame();
//Set the size to 800 pixels wide and 350 pixels high
win.setSize(900,350);
//Set the window as visible
win.setVisible(true);
win.addWindowListener(new WindowAdapter()
public void windowClosing(WindowEvent e)
System.exit(0);
//Mouse Listener Commands
public void mousePressed(MouseEvent evt)
if (evt.getSource()==textStockCode)
//Clear the Stock Code text field on clickin on it
textStockCode.setText("");
else if (evt.getSource()==textStockDesc)
//Clear the Stock Description text field on clickin on it
textStockDesc.setText("");
else if (evt.getSource()==textCurrentLevel)
textCurrentLevel.setText("");
//Clear the Current Level text field on clickin on it
else if (evt.getSource()==textReorderLevel)
textReorderLevel.setText("");
//Clear the Re-Order Level text field on clickin on it
else if (evt.getSource()==textPrice)
textPrice.setText("");
//Clear the Price text field on clickin on it
public void mouseReleased(MouseEvent evt){}
public void mouseClicked(MouseEvent evt){}
public void mouseEntered(MouseEvent evt){}
public void mouseExited(MouseEvent evt){}
}And this is the error that i get when compiling:
Phase1.java:355: cannot resolve symbol
symbol : class JDBCFrame
location: class Phase1
JDBCFrame win=new JDBCFrame();
^
Phase1.java:355: cannot resolve symbol
symbol : class JDBCFrame
location: class Phase1
JDBCFrame win=new JDBCFrame();Thanks for any help you can give meThe error is very clear here
Phase1.java:355: cannot resolve symbolsymbol : class JDBCFramelocation: class Phase1 JDBCFrame win=new JDBCFrame();
Where is this class JDBCFrame()?
Import that package or class -
Javac compiler Error - cannot resolve symbol - symbol StringBuilder?
Hi ,
I am using hp - ux system with java version "1.4.2.06". when i try to compile a program called CharSequenceDemo.java which is found in the java tutorials at this link
[CharSequenceDemo.java|http://java.sun.com/docs/books/tutorial/java/IandI/examples/CharSequenceDemo.java]
i get the following error:
$/opt/java1.4/bin/javac CharSequenceDemo.java
CharSequenceDemo.java:38: cannot resolve symbol
symbol : class StringBuilder
location: class CharSequenceDemo
StringBuilder sub =
^
CharSequenceDemo.java:39: cannot resolve symbol
symbol : class StringBuilder
location: class CharSequenceDemo
new StringBuilder(s.subSequence(fromEnd(end), fromEnd(start)));
^
CharSequenceDemo.java:44: cannot resolve symbol
symbol : class StringBuilder
location: class CharSequenceDemo
StringBuilder s = new StringBuilder(this.s);
^
CharSequenceDemo.java:44: cannot resolve symbol
symbol : class StringBuilder
location: class CharSequenceDemo
StringBuilder s = new StringBuilder(this.s);
^
4 errors
Please help on how to compile this program.I've been struggling with the same issue. The difference is that my system says I'm using version 1.6.0_05. I've tried running jucheck.exe. It tells me I've got the latest version installed.
Here is the code:
import java.lang.StringBuilder;
import java.util.Formatter;
public class UsingFormatter {
public static void main(String[] args) {
if (args.length != 1) {
System.err.println("usage: " +
"java format/UsingFormatter <format string>");
System.exit(0);
String format = args[0];
StringBuilder stringBuilder = new StringBuilder();
Formatter formatter = new Formatter(stringBuilder);
formatter.format("Pi is approximately " + format +
", and e is about " + format, Math.PI, Math.E);
System.out.println(stringBuilder);
}When I type javac UsingFormatter.java, I get:
UsingFormatter.java:1: cannot resolve symbol
symbol : class StringBuilder
location: package lang
import java.lang.StringBuilder;
^
UsingFormatter.java:2: cannot resolve symbol
symbol : class Formatter
location: package util
import java.util.Formatter;
^
UsingFormatter.java:14: cannot resolve symbol
symbol : class StringBuilder
location: class UsingFormatter
StringBuilder stringBuilder = new StringBuilder();
^
UsingFormatter.java:14: cannot resolve symbol
symbol : class StringBuilder
location: class UsingFormatter
StringBuilder stringBuilder = new StringBuilder();
^
UsingFormatter.java:15: cannot resolve symbol
symbol : class Formatter
location: class UsingFormatter
Formatter formatter = new Formatter(stringBuilder);
^
UsingFormatter.java:15: cannot resolve symbol
symbol : class Formatter
location: class UsingFormatter
Formatter formatter = new Formatter(stringBuilder);
^
6 errors
The compiler refuses to recognize the symbols StringBuilder and Formatter.
I have spent hours googling for an answer and trying every suggestion. Nothing works, not even the one about dropping the computer from the rooftop.
Ultimately, what I'm trying to accomplish (in a different program) is to use a text file as a form letter template and replace the %s placeholders with stings from my form object.
Any advice?
Edited by: javastudent_99 on Apr 3, 2008 1:48 PM
Maybe you are looking for
-
Mac mini mid 2010, graphic ghosts
*Mac mini mid 2010 2,4 Ghz 4 GB ram, Mac OSX 10.6.4* *Hi everyone, please help me because here in Italy also the Apple's technicians don't know what to say about this problem that I have.* I connect usb keys but also firewire ext drives and when I op
-
Problem with instant message in clustered environment
Hello, I have some problem with Instant Message service. We need to use it in our Production Environment (a clustered emvironment with a central instance, two dialog instances and two web dispatchers), some months ago we tested it in Development Envi
-
Business content activation 7.0
Hi, Recently we have upgraded from BI 3.5 to 7.0. We are facing a problem where in while activation of business content for some BI infoobjects some of the objects are not activated. What f i consider revised version and activate it, do i get object
-
How do I get UUT_RESULT ID?
Hi, I'm currently implementing another database that keeps track of all tests and re-tests of a UUT. I want to use the default database (MySQL) that ships with TestStand for the test results, though. My plan is to use the GUID in UUT_RESULT [ID] as a
-
Assigning keyboard shortcuts to volume controls
Hi, I have a new MacBook, with the default that F4 brings up Dashboard. I don't like Dashboard, and would rather have F4 show the desktop, next to F3, which shows all windows as the default. Moreover, I'd like to reclaim F7, F8, and F9, which are tak