Win a copy of TensorFlow 2.0 in Action this week in the Artificial Intelligence and Machine Learning forum!

sagarika chinya

Greenhorn
+ Follow
since Oct 17, 2002
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by sagarika chinya

I am pasting my main program here again, and for me it looks like my main is ok...
I still dont know whats wrong since I have public static void main(String[] args) defined my program!!
any clue as to whats wrong other than this??
-sagarika
import java.awt.*;
import javax.swing.*;
import javax.swing.tree.*;
import javax.swing.event.*;
public class DynamicTree extends JFrame {
public static void main(String[] args) {
// MY MAIN SEEMS TO BE OK
int n = 5; // Number of children to give each node
new DynamicTree(n);
}
public DynamicTree(int n) {
super("Creating a Dynamic JTree");
WindowUtilities.setNativeLookAndFeel();
addWindowListener(new ExitListener());
Container content = getContentPane();
JTree tree = new JTree(new OutlineNode(1, n));
content.add(new JScrollPane(tree), BorderLayout.CENTER);
setSize(300, 475);
setVisible(true);
}
}
17 years ago
i am trying to run a program to dynamically create a JTree,it complies fine but is giving runtimeerror NoSuchMethodError : Main
But i have used in the program and also its not an applet,I am not able to figure out what the error is,
any help is appreciated!!
thanks
sagarika
HEre comes the code
There are two different classes used in this!!
/* DynamicTree class*/
import java.awt.*;
import javax.swing.*;
import javax.swing.tree.*;
import javax.swing.event.*;
public class DynamicTree extends JFrame {
public static void main(String[] args) {
int n = 5; // Number of children to give each node
new DynamicTree(n);
}
public DynamicTree(int n) {
super("Creating a Dynamic JTree");
WindowUtilities.setNativeLookAndFeel();
addWindowListener(new ExitListener());
Container content = getContentPane();
JTree tree = new JTree(new OutlineNode(1, n));
content.add(new JScrollPane(tree), BorderLayout.CENTER);
setSize(300, 475);
setVisible(true);
}
}

//OutlineNOde class
import java.awt.*;
import javax.swing.*;
import javax.swing.tree.*;

public class OutlineNode extends DefaultMutableTreeNode {
private boolean areChildrenDefined = false;
private int outlineNum;
private int numChildren;
public OutlineNode(int outlineNum, int numChildren) {
this.outlineNum = outlineNum;
this.numChildren = numChildren;
}
public boolean isLeaf() {
return(false);
}
public int getChildCount() {
if (!areChildrenDefined)
defineChildNodes();
return(super.getChildCount());
}
private void defineChildNodes() {
// You must set the flag before defining children if you
// use "add" for the new children. Otherwise you get an infinite
// recursive loop, since add results in a call to getChildCount.
// However, you could use "insert" in such a case.
areChildrenDefined = true;
for(int i=0; i<numChildren; i++)
add(new OutlineNode(i+1, numChildren));
}
public String toString() {
TreeNode parent = getParent();
if (parent == null)
return(String.valueOf(outlineNum));
else
return(parent.toString() + "." + outlineNum);
}
}
17 years ago
I am writing a program to implement a B+ tree GUI interface. All the classes are compiling but when try to run my main class btview i am getting the following error. i am new to java,could any body explain as to whats going wrong??
thanks
sagarika
Exception in thread "main" java.lang.InternalError: Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable.
at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
at <Unloaded Method>
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:124)
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:63)
at <Unloaded Method>
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:124)
at java.awt.Toolkit$2.run(Toolkit.java:499)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:492)
at java.awt.Window.getToolkit(Window.java:432)
at nodeContent.<init>(nodeContent.java:54)
at btview.main(btview.java:25)
17 years ago
I am writing a program to implement a B+ tree GUI interface. All the classes are compiling but when try to run my main class btview i am getting the following error. i am new to java,could any body explain as to whats going wrong??
thanks
sagarika
Exception in thread "main" java.lang.InternalError: Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable.
at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
at <Unloaded Method>
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:124)
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:63)
at <Unloaded Method>
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:124)
at java.awt.Toolkit$2.run(Toolkit.java:499)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:492)
at java.awt.Window.getToolkit(Window.java:432)
at nodeContent.<init>(nodeContent.java:54)
at btview.main(btview.java:25)
17 years ago
I am changing a program written in a older version to the 1.4 version
when i used -deprecation I had to change the handleEvent to processEvent. Now i have a problem.
I want to capture int value in xPos and yPos but I am getting an erorr.
Could any one pls tell me where I am going wrong and how to correct it??
- thanks
sagarika
Here is the code
17 years ago
Hi,
I am getting the following error when I try to connect through source code, But query works fine when executed through SQLPLUS.
Here is my code

I am getting the following error
java.sql.SQLException: ORA-00933: SQL command not properly ended
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Exception.java:42)
at java.sql.SQLException.<init>(SQLException.java:43)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.ttc7.TTIoer.processError(Compiled Code)
at oracle.jdbc.ttc7.Oall7.receive(Compiled Code)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(Compiled Code)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteDescribe(TTC7Protocol.java:830)
at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java:2391)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2672)
at oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java:572)
at Banni1.query(Compiled Code)
at Banni1.main(Compiled Code)

Could anyone please help me to find where the problem could be.
Thanks
sagarika
I am getting the following error when i try to run my program. The program is just logging into a database and retrieving some records.I have a login method(to load the database) and a query method that queries the database and gets some records.
the query method is something like this


My main method passes query strings to the query method.
Main Method

I dont know why I am getting the following error.

java.sql.SQLException: ORA-00904: "MAR": invalid identifier
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Exception.java:42)
at java.sql.SQLException.<init>(SQLException.java:43)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.ttc7.TTIoer.processError(Compiled Code)
at oracle.jdbc.ttc7.Oall7.receive(Compiled Code)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(Compiled Code)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1093)
at oracle.jdbc.driver.OracleStatement.executeNonQuery(Compiled Code)
at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1940)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2709)
at oracle.jdbc.driver.OracleStatement.executeUpdate(OracleStatement.java:796)
at Banniinsertch.query(Compiled Code)
at Banniinsertch.main(Compiled Code)

My inputs are movie_id and return_date (20-MAR-02)
When i try to run the query at the SQL prompt it works!!!
I am new to jdbc, so can anyone pls tell whats causing these errors and how to correct it.

thanks
sagarika
I am new to java and jdbc, I have used ResultSet to query the database.I wanted to know how to store the result in a outputfile
ie
ResultSet rs = stmt.executeQuery(query);
while(rs.next()) {
String str = rs.getInt("movie_id");
String str2 = rs.getString("ReturnDate")
can i use FileOutputStream,OutputStreamWriter,BufferedWriter and PrintWriter to write the str and str2 into an output file,

any help would be appreciated.
thanks
sagarika
Hi,
I have written a program using StringTokenizer.It takes a string and breaks it into tokens.The argument for StringTokenizer is a String.And this if working fine.
My question is ..
I want to input a text file from command line and read the text file and after performing some operation output the results to a text file. I am new to java, can any body tell as to which methods/classes to use?
If i use FileInputStream , i am getting the following error
Incompatible type for constructor. Can't convert java.io.FileInputStream to java.lang.String.
StringTokenizer st = new StringTokenizer(fromFile);
can anyone tell me whats wrong??
thanks
sagarika
hi,
I am new to java and i wanted to know if there is a function like scanf in java which can accept user input?
thanks
hi,
I am new to java and i wanted to know if there is a function like scanf which can accept user input?
thanks
18 years ago