Hashtable in core of a class
Hi,
I try to use Hashtable in the core of a public class.
But I cannot access to put method from Hashtable from the core of the class.
I must access put method from a method of this class.
Why ?
import java.util.Hashtable;
public class Help {
Hashtable<String, String> helpHash = new Hashtable<String, String>();
Thanks
Linux, Java 1.6, compiled by Eclipse in java 1.5
I love these.
import java.util.Hashtable;
public class Help {
Hashtable<String, String> helpHash = new Hashtable<String, String>();
}There doesn't appear to be any problems there.
Unfortunately for you, the part you elipsed is the part where your problems occur. Without knowing what the hell you're referring to when you say
But I cannot access to put method from Hashtable from the core of the class. I must access put method from a method of this class. Why?we subsequently cannot help you.
If it's any help, please be aware that all code that manipulates objects (unless it's lazy instantiation) must be in constructor/method bodies (between { and }'s).
You can't just have this:
import java.util.Hashtable;
public class Help {
Hashtable<String, String> helpHash = new Hashtable<String, String>();
helpHash.put(someObject);
}Illegal. :)
helpHash.put(someObject); must be in a constructor or method body. What you have above is just a class body. Constructor / method bodies are inside class bodies.
Similar Messages
-
Hi Guys,
I wanted to know where are the Java packages' class files are located in my computer?
For example, I want to find the location of java.util.Vector, or java.lang.String. I've ran a search but found nothing, so I guess those files are hiding somewhere in a jar or something, Does anyone know where are those files?Rovat wrote:
... I want to find the location of java.util.Vector, or java.lang.String. I've ran a search but found nothing, so I guess those files are hiding somewhere in a jar or something, Does anyone know where are those files?The class files are in rt.jar.
The source for the class files are in the src.zip file of the SDK. -
Applet accidentally requests Java Core API classes from network
Hi,
starting an applet from a customers client machine (IE7, Windows XP, Standard JRE Installation of Java 1.6.0_26), I see in the tomcat access log entries signalizing that core java api classes are accidentally requested from the server:
"GET /mywebapp/applet/java/lang/StringBuilder.class HTTP/1.1" 404 1156 0
"GET /mywebapp/applet/javax/swing/JPanel.class HTTP/1.1" 404 1141 0
"GET /mywebapp/applet/java/net/JarURLConnection.class HTTP/1.1" 404 1162 0
"GET /mywebapp/applet/java/util/jar/JarEntry.class HTTP/1.1" 404 1153 0
"GET /mywebapp/applet/java/util/jar/JarFile.class HTTP/1.1" 404 1150 0
Although tomcat responses with HTTP 404, the applet works fine.
Questions:
1. For me, it looks like a security risk when the browser tries to load system classes from the network instead of using the local files from the jre dir, doesn't it?
2. When starting the applet from my local machine (different network), no tomcat logfile entries are generated. An interesting fact is, that in the customer network, the applet "codebase" parameter in the HTML source gets modifed by a proxy server for whatever reason like the following:
<applet codebase="http://mydomain.org/mywebapp/applet">
becomes some kind of:
<applet codebase="http://mydomain.org/mywebapp/applet/+sgrkjkrlgjklJKLjekrr4jewlkfjkerlkrelkjgregkjerlkgljkeglkjgjelkLKJLKefjei55435ijjkl=+">
It seems that such codebases confuse the classloader. Any ideas about that?
Thank you so much for any hints!<applet codebase="http://mydomain.org/mywebapp/applet">
So you're loading individual .class files from the codebase? Don't do that, put them into a JAR and specify the JAR file(s) as the codebase. Much more efficient and it may solve this problem too. -
Hi,
We are using JDeveloper 10.1.3.0.4(SU5) on windows for development of ADF application. We need to deploy the developed application onto Oracle Application Server 10g (10.1.3) which is running on Solaris. We are using BC4J, WAR and EAR deployment profiles in jdeveloper to create the .war and .ear files.
If I deploy the generated ear on a standalone OC4J server install on my windows PC, it works fine.
Now when I deploy the generated .ear file onto the Oracle Application Server 10.1.3 through Application Server Control interface and then try to access the jspx pages under our application we are getting following error:
oracle.classloader.util.AnnotatedNoClassDefFoundError: Missing class: javax.servlet.jsp.jstl.core.Config Dependent class: com.sun.faces.application.ViewHandlerImpl Loader: accaweb.web.accaweb:0.0.0 Code-Source: /oracle/app/oracle/product/10gas3/j2ee/home/applications/accaweb/accaweb/WEB-INF/lib/jsf-impl.jar Configuration: WEB-INF/lib/ directory in /oracle/app/oracle/product/10gas3/j2ee/home/applications/accaweb/accaweb/WEB-INF/libThe missing class is available from the following locations: 1. Code-Source: /oracle/app/oracle/product/10gas3/j2ee/home/default-web-app/WEB-INF/lib/jstl.jar (from WEB-INF/lib/ directory in /oracle/app/oracle/product/10gas3/j2ee/home/default-web-app/WEB-INF/lib) This code-source is available in loader default.web.defaultWebApp:0.0.0. at oracle.classloader.PolicyClassLoader.handleClassNotFound (PolicyClassLoader.java:2051) [oracle/app/oracle/product/10gas3/j2ee/home/lib/pcl.jar (from system property java.class.path), by sun.misc.Launcher$AppClassLoader@1482257]
I have confirmed that the .war file inside the .ear file does contain the jstl.jar file under WEB-INF/lib folder. And the jar file does contain the class 'javax.servlet.jsp.jstl.core.Config'
As a workaround, I found that if I copy the jstl.jar file from default-web-app to my application web-inf/lib folder, things start to work fine. ie copy from: '/oracle/app/oracle/product/10gas3/j2ee/home/default-web-app/WEB-INF/lib/jstl.jar'
to: '/oracle/app/oracle/product/10gas3/j2ee/home/applications/accaweb/accaweb/WEB-INF/lib/'
– or –
Another workaround is to add the '/oracle/app/oracle/product/10gas3/j2ee/home/default-web-app/WEB-INF/lib/jstl.jar' file in the classpath for my web application through Application Server Control setting page.
Now both of these workaround needs us to perform additional post deployment steps which should really not be required since the jar files is included in the project.
Has anyone faced this issue? Any pointers in this respect will be a great help.
regards - rutwikSurprise Surprise !
I just tried deploying the file via uploading it from the Application Server Control UI and it worked fine.
Till now, I was ftp'ing the ear file from my PC to the server on which Oracle AS is running and was telling Application Server Control to pick form that uploaded location.
I am still not clear on why it works with HTTP upload and not via the FTP upload?
cheers - rutwik -
Unable to compile class for JSP
Please can anyone help me to solve this.
Actually,this is the condition.
In my db,there is a table called UserPassword, which has 4
fields(empNo,UserName,password,level). Now I want to do these things:
When the user submits the data to create a new account via HTML form, it submits the data to the file called CreateAcc.jsp. In this file it perform some logic,here are they.
1)To check the empNo,if it is already exist in the DB,
if empNo =exist then display error.(record already exist)
if empNo =notexist then do task 2).
2)check the UserName,if it is already exist in the db,
if UserName=exist then display error.(because it's a primary key)
if UserName=notexist then do task 3).
3)Create a new user account and save it to the db.
To do these tasks,I never create a new objects for the tasks 1) and 2).
only for task 3)create an object.
Is it the right way?
Here is the file CreateAcc.jsp
<%@ page language="java" %>
<%@ page import="core.UserAccManager" %>
<%@ page import="data.UserPassword" %>
<jsp:useBean id="UserAccManager" class="core.UserAccManager" scope="session"/>
<jsp:setProperty name="UserAccManager" property="*"/>
<jsp:useBean id="UserPassword" class="data.UserPassword" scope="session"/>
<jsp:setProperty name="UserPassword" property="*"/>
<%
String nextPage ="MainForm.jsp";
if(UserPassword.verifyEmpno()){
if(UserPassword.verifyUsername()){
if(UserPassword.createAcc()) nextPage ="MsgAcc.jsp";
}else{
nextPage="UserNameExist.jsp";
else{
nextPage="UserAccError.jsp";
%>
<jsp:forward page="<%=nextPage%>"/>The directory structure:
UserPassword.java- F:/Project/core/data/UserPassword.java
UserAccManager.java - F:/Project/core/UserAccManager.java
Now both are compiling.I put the class files into the TOMCAT,as follows.
UserAccManager.class - webapps/mySystemName/WEB-INF/classes/core/
UserPassword.class - webapps/mySystemName/WEB-INF/classes/core/data/
Here is the full code of the file UserAccManager.java.
package core; //Is this right?
import data.UserPassword; //Is this right?
import java.io.*;
import java.sql.*;
import java.util.*;
import javax.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
public final class UserAccManager{
private static final String DRIVER = "com.mysql.jdbc.Driver";
private static final String URL = "jdbc:mysql://localhost:3306/superfine";
private static Connection connection;
private static PreparedStatement pstmt1;
private static PreparedStatement pstmt2;
private static PreparedStatement pstmt3;
private UserAccManager(){
// Initializes the connection and statements
public static void initConnection() {
if (connection == null) {
try {
String sql;
// Open the database
Class.forName(DRIVER).newInstance();
connection = DriverManager.getConnection(URL);
// Prepare the statements
sql = "SELECT * FROM UserPassword where empNo= ?";
pstmt1 = connection.prepareStatement(sql);
sql = "SELECT UserName FROM UserPassword where UserName= ?";
pstmt2 = connection.prepareStatement(sql);
sql ="INSERT INTO UserPassword VALUES(?,?,?,?)";
pstmt3 = connection.prepareStatement(sql);
catch (Exception ex) {
System.err.println(ex.getMessage());
// Closes the connection and statements
// Method to be called by main class when finished with DB
public void closeConnection() {
//same as previous
public static boolean verifyEmpno(int empno) {
boolean emp_no_select_ok = false;
int emp = -1;
initConnection();
try {
pstmt1.setInt(1, empno);
ResultSet rs1 = pstmt1.executeQuery();
while(rs1.next()){
emp=rs1.getInt("empNo");
if(emp>0)
emp_no_select_ok = false;
} else{
emp_no_select_ok = true;
rs1.close();
pstmt1.close();
catch (Exception ex) {
System.err.println(ex.getMessage());
return emp_no_select_ok;
public static boolean verifyUsername(String username) {
boolean user_name_select_ok = false;
String user = "xxxx";
initConnection();
try {
pstmt2.setString(1, username);
ResultSet rs2 = pstmt2.executeQuery();
while(rs2.next()){
user=rs2.getString("UserName");
if(!user.equals("xxxx"))
user_name_select_ok = false;
} else{
user_name_select_ok = true;
rs2.close();
catch (Exception ex) {
System.err.println(ex.getMessage());
return user_name_select_ok;
public static boolean createAcc(int empno, String username, String password, int
level){
boolean create_acc_ok = false;
initConnection();
try{
//create a new object,from the UserPassword table.
UserPassword useraccount = new UserPassword();
useraccount.setEmpno(empno);
useraccount.setUsername(username);
useraccount.setPassword(password);
useraccount.setLevel(level);
//assign value for ???
pstmt3.setInt(1, useraccount.getEmpno());
pstmt3.setString(2, useraccount.getUsername());
pstmt3.setString(3, useraccount.getPassword());
pstmt3.setInt(4, useraccount.getLevel());
if(pstmt3.executeUpdate()==1) create_acc_ok=true;
pstmt3.close();
//con.close();
catch(SQLException e2){
System.err.println(e2.getMessage());
return create_acc_ok;
}here is the bean (part of it)
package data; //is it right?
import java.io.*;
import java.sql.*;
import java.util.*;
import javax.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class UserPassword
private int empno;
private String username;
private String password;
private int level;
// Constructor
public UserPassword()
this.empno = empno;
this.username = username;
this.password = password;
this.level = level;
// setters and getters are here.
// public boolean verifyEmpno() {
// return UserAccManager.verifyEmpno(empno);
// public boolean verifyUsername(String username) {
// return UserAccManager.verifyUsername(username);
// These 2 methods not compile with or without para's.So I leave that job for the
//controll class UserAccManager.java.
Now my problem is this: When I submit data, there is an error;org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: -1 in the jsp file: null
Generated servlet error:
[javac] Compiling 1 source file
C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:8:
cannot access core.data.UserPassword
bad class file: C:\Program Files\Apache Group\Tomcat
4.1\webapps\HRM\WEB-INF\classes\core\data\UserPassword.class
class file contains wrong class: data.UserPassword
Please remove or make sure it appears in the correct subdirectory of the classpath.
import core.data.UserPassword;
^
1 error
Are there any mistakes? If so tell me where is it and how to change them.Please help.I try it that way, but it don't compile.
Error:core\data\UserPassword.java:package javax.servlet does not exist
import javax.servlet.*;
core\data\UserPassword.java:package javax.servlet.http does not exist
import javax.servlet.http.*;
So,I comment them only in the UserPassword.java file,and compile it again.
Then it compile well.I goto the directory to get the .class files.
But there is only UserPassword.class inside the data folder. There is not
UserAccManager.class in the core folder.
Then I try this way,I put my 2 java files in to a new folder,
F:\SystemName\com
When I try it that way, but it don't compile.
javac -classpath . -d . com\*.javaError:com\UserPassword.java:package javax.servlet does not exist
import javax.servlet.*;
com\UserPassword.java:package javax.servlet.http does not exist
import javax.servlet.http.*;
So,I comment them only in the UserPassword.java file,and compile it again.
Now both are compiling well.There was 2 class files.
I put them in to the WEB-INF/classes/com directory.
Start the server.But it gave errors:
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:68: cannot resolve symbol
symbol : variable empno
location: class org.apache.jsp.CreateAcc_jsp
if(UserPassword.verifyEmpno(empno)){
^
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:69: cannot resolve symbol
symbol : variable username
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.verifyUsername(username)){
^
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:69: non-static method
verifyUsername(java.lang.String) cannot be referenced from a static context
if(UserAccManager.verifyUsername(username)){
^
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable empno
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable username
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable password
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable level
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: non-static method
createAcc(int,java.lang.String,java.lang.String,int) cannot be referenced from a static
context
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
8 errorsTo solve the problem non-static method,I goto the UserAccManager.java file and do these
things.
package com;
import java.io.*;
import java.sql.*;
import java.util.*;
import javax.sql.*;
//import javax.servlet.*; //otherwise it tells an error.(package
//javax.servlet does not exist)
//import javax.servlet.http.*;
public class UserAccManager {
private static final String DRIVER = "com.mysql.jdbc.Driver";
private static final String URL = "jdbc:mysql://localhost:3306/superfine";
private static Connection connection;
private static PreparedStatement pstmt1;
private static PreparedStatement pstmt2;
private static PreparedStatement pstmt3;
private UserAccManager() {
// Initializes the connection and statements
private static void initConnection() {
//same
// Closes the connection and statements
// Method to be called by main class when finished with DB
public static void closeConnection() {
//same
public static boolean verifyEmpno(int empno) {
// same.
public static boolean verifyUsername(String username) {
//same.
public static boolean createAcc(int empno, String username, String password, int
level){
//same
package com;
import java.io.*;
import java.sql.*;
import java.util.*;
import javax.sql.*;
//import javax.servlet.*;
//import javax.servlet.http.*;
public class UserPassword {
// same
Again compile those files and put .class filses into the WEB-INF/classes/com directory.
When i submits the data via the form it generates an error:
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 9 in the jsp file: /CreateAcc.jsp
Generated servlet error:
[javac] Compiling 1 source file
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:68: cannot resolve symbol
symbol : variable empno
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.verifyEmpno(empno)){
^
An error occurred at line: 9 in the jsp file: /CreateAcc.jsp
Generated servlet error:
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:69: cannot resolve symbol
symbol : variable username
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.verifyUsername(username)){
^
An error occurred at line: 9 in the jsp file: /CreateAcc.jsp
Generated servlet error:
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable empno
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
An error occurred at line: 9 in the jsp file: /CreateAcc.jsp
Generated servlet error:
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable username
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
An error occurred at line: 9 in the jsp file: /CreateAcc.jsp
Generated servlet error:
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable password
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
An error occurred at line: 9 in the jsp file: /CreateAcc.jsp
Generated servlet error:
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable level
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
6 errorshere is the CreateAcc.jsp file
<%@ page language="java" %>
<%@ page import="com.UserAccManager" %>
<%@ page import="com.UserPassword" %>
<jsp:useBean id="userPassword" class="com.UserPassword" scope="request"/>
<jsp:setProperty name="userPassword" property="*" />
<%
String nextPage ="MainForm.jsp";
if(UserAccManager.verifyEmpno(empno)){
if(UserAccManager.verifyUsername(username)){
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
}else{
nextPage="UserNameExist.jsp";
else{
nextPage="UserAccError.jsp";
%>
<jsp:forward page="<%=nextPage%>"/>Please, anyone know how to send these parameters to the java file.
Thanks. -
Class instantiation through mxml - setting properties
Hi,
I'm trying to create a reusable component with an actionscript class.
I'd like to be able to set a handful of the class' properties withmxml attributes. So far, I've had no success doing so.
I've subset my problem into a separate, simplied project in an attempt to rule out any of the other parts of the real application interfering with what I'm attempting to accomplish. Unfortunately, my simplified project produces the same result.
In my example, I'm just trying to set value of the property "myValue." Can anyone tell me what I'm doing wrong? What am I missing?
Thanks in advance for any help!
Main application (TestProj.mxml)
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
minWidth="955" minHeight="600"
xmlns:pkg="pkg.*">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<pkg:TestClass myvalue="some value" />
</s:Application>
Actionscript class (pkg\TestClass.as)
package pkg
import mx.controls.Alert;
import mx.core.UIComponent;
public class TestClass extends UIComponent
private var _myvalue:String;
public function TestClass()
Alert.show("myvalue=" + this._myvalue);
public function get myvalue():String
return _myvalue;
public function set myvalue(value:String):void
_myvalue = value;Hi,
The property gets set correctly, but the constructor of your class will always execute before the attributes - this is because Flex needs to create the instance and execute the c-tor before it can set the values on the instance. Instead try something like this:
<pkg:TestClass id="foo" myvalue="some value" initialize="{Alert.show(foot.myvalue)}" />
This will execute the Alert.show when the component is being initialized. If you need to put some init code in the component itself and that code relies on values set in MXML, then you can override UIComponent's public function initialize():void.
-Evtim -
Cannot find symbol : class ! problem
Hello,
I have 2 java files (CD.java & CDCatalog.java) in a package called "testPackage". I can compile CD.java, but CDCatalog.java (that creates CD instances) gives following error - cannot find symbol symbol : class CD
Below are the 2 files, please tell me why I get this errors , thanks!
1) CDCatalog.java
package testPackages;
import java.util.Hashtable;
//import testPackages.CD;
public class CDCatalog {
/** The CDs, by title */
private Hashtable catalog;
public CDCatalog( ) {
catalog = new Hashtable( );
// Seed the catalog
addCD(new CD("Nickel Creek", "Nickel Creek", "Sugar Hill"));
addCD(new CD("Let it Fall", "Sean Watkins", "Sugar Hill"));
addCD(new CD("Aerial Boundaries", "Michael Hedges", "Windham Hill"));
addCD(new CD("Taproot", "Michael Hedges", "Windham Hill"));
public void addCD(CD cd) {
if (cd == null) {
throw new IllegalArgumentException("The CD object cannot be null.");
catalog.put(cd.getTitle( ), cd);
2) CD.java
package testPackages;
public class CD {
private String title;
private String artist;
private String label;
public CD( ) {
// Default constructor
public CD(String title, String artist, String label) {
this.title = title;
this.artist = artist;
this.label = label;
public String getTitle( ) {
return title;
public void setTitle(String title) {
this.title = title;
public String getArtist( ) {
return artist;
public void setArtist(String artist) {
this.artist = artist;
public String getLabel( ) {
return label;
public void setLabel(String label) {
this.label = label;
public String toString( ) {
return "'" + title + "' by " + artist + ", on " +
label;
}just tried it as well, no problems, provided you
compile CD.java firstI just tried from the shell ans look at this...
E:\testPackages>dir
Volume in drive E is MYFLASHDISK
Volume Serial Number is 483B-B160
Directory of E:\testPackages
05/24/2006 07:48 PM <DIR> .
05/24/2006 07:48 PM <DIR> ..
05/24/2006 07:20 PM 1,143 CD.java
05/24/2006 07:50 PM 1,053 CD.class
05/24/2006 07:56 PM 972 CDCatalog.java
3 File(s) 3,168 bytes
2 Dir(s) 1,024,503,808 bytes free
E:\testPackages>javac -cp e:\testPackages CDCatalog.java
CDCatalog.java:30: cannot find symbol
symbol : class CD
location: class testPackages.CDCatalog
public void addCD(CD cd) {
^
CDCatalog.java:24: cannot find symbol
symbol : class CD
location: class testPackages.CDCatalog
addCD(new CD("Nickel Creek", "Nickel Creek", "Sugar Hill"));
^
CDCatalog.java:25: cannot find symbol
symbol : class CD
location: class testPackages.CDCatalog
addCD(new CD("Let it Fall", "Sean Watkins", "Sugar Hill"));
^
CDCatalog.java:26: cannot find symbol
symbol : class CD
location: class testPackages.CDCatalog
addCD(new CD("Aerial Boundaries", "Michael Hedges", "Windham Hill"));
^
CDCatalog.java:27: cannot find symbol
symbol : class CD
location: class testPackages.CDCatalog
addCD(new CD("Taproot", "Michael Hedges", "Windham Hill"));
^
5 errors
E:\testPackages>I am now officially confused. I even specified the exact path to the CD.class file and javac still didnt like it.
I'll dig some more. It has to be related to the classpath some how..
JJ
Still Stumped.. I'll sleep on it..
Message was edited by:
Java_Jay -
An XJC compilation error - Could not load class (..) for type cvsversion
I've got a strange compilation error using NetBeans 4.0 (I'd guess the version does not matter here) and Ant 1.6.2. When the following task is executed,
<target name="compile_ofx_schema">
<antcall target="clean-ofx"/>
<delete dir="${ofx-jaxb-src.dir}"/>
<mkdir dir="${ofx-jaxb-src.dir}" />
<xjc schema="${schema.dir}/ofx102.xsd" package="com.xxx.ofx102" target="${ofx-jaxb-src.dir}">
<arg value="-nv" />
<arg value="-extension" />
</xjc>
</target>
I get the error from NetBeans console,
Class org.xml.sax.SAXException loaded from parent loader (parentFirst)
Class java.io.IOException loaded from parent loader (parentFirst)
D:\appserver\build.xml:797: unable to parse the schema. Error messages should have been provided
at com.sun.tools.xjc.XJCTask._doXJC(XJCTask.java:334)
at com.sun.tools.xjc.XJCTask.doXJC(XJCTask.java:283)
at com.sun.tools.xjc.XJCTask.execute(XJCTask.java:227)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.Target.performTasks(Target.java:369)
at org.apache.tools.ant.Project.executeTarget(Project.java:1214)
at org.apache.tools.ant.Project.executeTargets(Project.java:1062)
at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:217)
at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:236)
at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:125)
BUILD FAILED (total time: 4 seconds)
Could not load class (org.apache.tools.ant.tasksdefs.cvslib.CvsVersion) for type cvsversion
Could not load class (org.apache.tools.ant.tasksdefs.cvslib.CvsVersion) for type cvsversion
And when I run the Ant task from the command line, I don't get the error at all.
Any help is greatly appreciated.That was a great finding from you. Thank you.
I followed your alternative approach and updated the ant.jar file. The "Could not load class..." error went away but the stack trace still remains. Now I am clueless again since I have ant on the debug mode and can't find any more useful info.
Class com.sun.tools.xjc.reader.internalizer.LocatorTable loaded from ant loader (parentFirst)
Class java.util.HashSet loaded from parent loader (parentFirst)
Class javax.xml.parsers.DocumentBuilderFactory loaded from parent loader (parentFirst)
Couldn't load Resource org/netbeans/core/xml/DOMFactoryImpl.class
Couldn't load ResourceStream for META-INF/services/javax.xml.parsers.DocumentBuilderFactory
Class org.apache.crimson.jaxp.DocumentBuilderFactoryImpl loaded from parent loader (parentFirst)
Class javax.xml.parsers.SAXParserFactory loaded from parent loader (parentFirst)
Couldn't load Resource org/netbeans/core/xml/SAXFactoryImpl.class
Couldn't load ResourceStream for META-INF/services/javax.xml.parsers.SAXParserFactory
Class org.apache.crimson.jaxp.SAXParserFactoryImpl loaded from parent loader (parentFirst)
Class javax.xml.parsers.DocumentBuilder loaded from parent loader (parentFirst)
Class java.util.Map loaded from parent loader (parentFirst)
Class javax.xml.parsers.SAXParser loaded from parent loader (parentFirst)
Finding class com.sun.tools.xjc.reader.xmlschema.parser.XMLSchemaInternalizationLogic$ReferenceFinder
Loaded from D:\bbw\build\Common_3.6\Packaged\appserver\lib\jaxb\jaxb-xjc.jar com/sun/tools/xjc/reader/xmlschema/parser/XMLSchemaInternalizationLogic$ReferenceFinder.class
Finding class com.sun.tools.xjc.reader.internalizer.AbstractReferenceFinderImpl
Loaded from D:\bbw\build\Common_3.6\Packaged\appserver\lib\jaxb\jaxb-xjc.jar com/sun/tools/xjc/reader/internalizer/AbstractReferenceFinderImpl.class
Class org.xml.sax.helpers.XMLFilterImpl loaded from parent loader (parentFirst)
Class com.sun.tools.xjc.reader.internalizer.AbstractReferenceFinderImpl loaded from ant loader (parentFirst)
Class com.sun.tools.xjc.reader.xmlschema.parser.XMLSchemaInternalizationLogic$ReferenceFinder loaded from ant loader (parentFirst)
Class org.xml.sax.XMLFilter loaded from parent loader (parentFirst)
Finding class com.sun.tools.xjc.reader.internalizer.VersionChecker
Loaded from D:\bbw\build\Common_3.6\Packaged\appserver\lib\jaxb\jaxb-xjc.jar com/sun/tools/xjc/reader/internalizer/VersionChecker.class
Class com.sun.tools.xjc.reader.internalizer.VersionChecker loaded from ant loader (parentFirst)
Finding class com.sun.tools.xjc.reader.internalizer.DOMBuilder
Loaded from D:\bbw\build\Common_3.6\Packaged\appserver\lib\jaxb\jaxb-xjc.jar com/sun/tools/xjc/reader/internalizer/DOMBuilder.class
Finding class com.sun.xml.bind.marshaller.SAX2DOMEx
Loaded from D:\bbw\build\Common_3.6\Packaged\appserver\lib\jaxb\jaxb-impl.jar com/sun/xml/bind/marshaller/SAX2DOMEx.class
Class org.xml.sax.ContentHandler loaded from parent loader (parentFirst)
Class com.sun.xml.bind.marshaller.SAX2DOMEx loaded from ant loader (parentFirst)
Class com.sun.tools.xjc.reader.internalizer.DOMBuilder loaded from ant loader (parentFirst)
Class java.util.Stack loaded from parent loader (parentFirst)
Class org.w3c.dom.Document loaded from parent loader (parentFirst)
Class org.xml.sax.XMLReader loaded from parent loader (parentFirst)
Class org.w3c.dom.Node loaded from parent loader (parentFirst)
Class org.w3c.dom.Element loaded from parent loader (parentFirst)
Class javax.xml.parsers.ParserConfigurationException loaded from parent loader (parentFirst)
Class org.xml.sax.SAXException loaded from parent loader (parentFirst)
Class java.io.IOException loaded from parent loader (parentFirst)
D:\bbw\build\Common_3.6\Packaged\appserver\build.xml:799: unable to parse the schema. Error messages should have been provided
at com.sun.tools.xjc.XJCTask._doXJC(XJCTask.java:334)
at com.sun.tools.xjc.XJCTask.doXJC(XJCTask.java:283)
at com.sun.tools.xjc.XJCTask.execute(XJCTask.java:227)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.Target.performTasks(Target.java:369)
at org.apache.tools.ant.Project.executeTarget(Project.java:1214)
at org.apache.tools.ant.Project.executeTargets(Project.java:1062)
at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:217)
at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:236)
at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:125)
BUILD FAILED (total time: 1 second)
Any suggestions? BTW, I did not upgrade NetBeans to v5.5 due that my code is still JDK1.4 based. -
Importing classes from Jar files..?
I've run into a problem that I am having some difficulty solving. I currently trying to port a two part Java UI project from Solaris to Windows. The first is a package of core classes out of which I (successfully) create a jar file. The second is a product-specific package that imports the core classes from the package created in the first. The problem is that the second package fails to build because javac says the package from part one does not exist. Here's what I know:
- This UI (built via a Makefile) builds successfully under Solaris
- The jar file that I created in the first part exists in the appropriate directory.
- When I view the contents of that jar it appears as though everything is there.
- The jar file is appropriately included in the classpath of the second build.
Any suggestions you could provide, or resources you could point me to would be greatly appreciatedjh.jar is a static, 3rd party component. Doesn't seem to be giving me any grief, at least not yet.
Correct on your second point.
This is interesting. When I open my "CoreConsole.jar"
file, I DO NOT see any reference to the
com.emc.avalon.core.server package, only a list of
class files that make up that package. You should see the .class files on the left and the relative path on the right.
Also, all of the class file listings have absolute paths according
to the location on my machine they were built, for example:
m:/xpe/CoreConsole/classes/com/emc/avalon/core/server/MessageLogUtility.class
Is this a problem..?Yes, that should be a relative path, with the first entry being the first name in the package statement. So you should see an entry MessageLogUtility.class, and the path should be com.emc.avalong.core.server.
If you can't see the class that's missing, that would explain why the class loader can't find it, either. -
How to create custom java class in Content Server
Hi All,
I want to develop a custom java class (.class) file and upload in the UCM(Stellent Content Server). The problem is that I have to use some objects like DataResultSet, SharedObjects etc in my java class file. Since these class files resides in the Content Server I am not able to create a custom java class with these objects.
Can any one help me to solve the above issue
With thanks and regards
MohanHey there,
All of the core content server class files are included in a single jar file. This jar is in one of 2 places in the 10gr3 version of UCM:
1. If you have an unpatched content server include $IntradocDir/shared/classes/server.zip in your classpath
2. If you have a patched content server include $IntradocDir/custom/CS10gR35CoreUpdate/classes.jar in your classpath.
In UCM 11g the jar file is located in %MIDDLEWARE_HOME%/Oracle_ECM1/ucm/idc/jlib/idcserver.jar
P.S. Venkat is correct, post UCM specific questions in the ECM forum.
Hope that helps,
Andy Weaver - Senior Software Consultant
Fishbowl Solutions < http://www.fishbowlsolutions.com?WT.mc_id=L_Oracle_Consulting_amw_OTN_WCS > -
Need a simple network accessibility for RMI class files.
I am trying to get an RMI server working and need a way to make the class files network accessible. The link: http://java.sun.com/javase/technologies/core/basic/rmi/class-server.zip does seem to have the server anymore. Anyone know where to get a copy of it?
Is there a way to do this with Jini?
Can oc4j be used?I am trying to get an RMI server working and need a way to make the class files network accessible. The link: http://java.sun.com/javase/technologies/core/basic/rmi/class-server.zip does seem to have the server anymore. Anyone know where to get a copy of it?
Not much point really. That class file server only served .class files, not even JARs.
Is there a way to do this with Jini?No.
Can oc4j be used?Not by itself.
Anything that will serve HTTP requests will do. Such as an HTTP server. Such as the one built into the JDK for example. -
Shopping cart!! Retriving values from Hashtable?
Hi,
Could you please help me solve this problem?
I am adding some values to the Hashtable. For every time I add the server is definitely showing
me that some thing is added to the Hashtable. But when I try to print the values present in
Hashtable, I do not see any thing on the browser other than "table headers" ? Can any one help
me?
Here are the codes
ShopBean.java
import java.util.*;
import java.lang.*;
public class ShopBean
private Hashtable hashtable = new Hashtable();
public ShopBean()
public void addToCart(String itemid,String name,float price,int quantity)
String[] items = {itemid,name,Float.toString(price),Integer.toString(quantity)};
if(hashtable.containsKey(itemid))
String[] tmpItem = (String[])hashtable.get(itemid);
int tmpQuantity = Integer.parseInt(tmpItem[3]);
quantity += tmpQuantity;
tmpItem[3] = Integer.toString(quantity);
else
hashtable.put(itemid,items);
public Enumeration getEnumeration()
return hashtable.elements();
Tibre.java
public class Tibre extends HttpServlet
String user,s1,s2,s3,s4,s5,s6,s7,prev,next,flag;
int i,count=0,i1,i2,i3,i4,records=0,from,to,no,rem,k,c;
public void doGet(HttpServletRequest req,HttpServletResponse res)
doPost(req,res);
public void doPost(HttpServletRequest req,HttpServletResponse res)
try
ServletOutputStream sos = res.getOutputStream();
HttpSession ses = req.getSession(true);
user=(String)ses.getValue("user");
ShopBean cart = new ShopBean();
String id = req.getParameter("id");
if(id != null)
String name = req.getParameter("name");
Float price = new Float(req.getParameter("price"));
cart.addToCart(id,name,price.floatValue(),1);
System.out.println("cart values in tibre.java"+cart);
sos.println("<html>");
sos.println("<body bgcolor=lightyellow>");
sos.println("<p>Welcome to Online shopping "+user+" , Please see the
gallery of items.</p>");
sos.println("<table border='1' cellspacing='1' width='41%'
cellpadding='2' id='AutoNumber1'>");
sos.println("<tr>");
sos.println("<td width='21%'>");
sos.println("<img border='0' src='images/11.gif' width='120'
height='150'> ");
sos.println("</td>");
sos.println("<td width='79%'>");
sos.println("<img border='0' src='images/22.gif' width='120'
height='150'></td>");
sos.println("</tr>");
sos.println("<tr>");
sos.println("<form method='post'
action='http://localhost:8080/servlet/Tibre'>");
sos.println("<td width='21%'>$300 <input type=submit value='Add
to Cart' name=tibre1>");
sos.println("</td>");
sos.println("<input type='hidden' value='100' name='id'>");
sos.println("<input type='hidden' value='Tibre' name='name'>");
sos.println("<input type='hidden' value='300.89' name='price'>");
res.sendRedirect("http://localhost:8080/servlet/Tibre");
sos.println("</form>");
sos.println("<form method='post'
action='http://localhost:8080/servlet/Tibre'>");
sos.println("<td width='79%'>$800.99 <input type=submit
value='Add to Cart' name=tibre2>");
sos.println("</td>");
sos.println("<input type='hidden' value='200' name='id'>");
sos.println("<input type='hidden' value='Compaq' name='name'>");
sos.println("<input type='hidden' value='800.99' name='price'>");
res.sendRedirect("http://localhost:8080/servlet/Tibre");
sos.println("</form>");
sos.println("</tr>");
sos.println("</table>");
sos.println("<a href='http://localhost:8080/servlet/ViewCart'>View
Cart</a>");
sos.println("</body>");
sos.println("</html>");
catch(Exception e)
e.printStackTrace();
ViewCart.java // When I click viewcart I should display the contents from the hashtable
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
public class ViewCart extends HttpServlet
public void doGet(HttpServletRequest req,HttpServletResponse res)
try
ServletOutputStream sos = res.getOutputStream();
ShopBean cart = new ShopBean();
sos.println("<html><head>");
sos.println("<title> Shopping Cart Contents</title>");
sos.println("</head>");
sos.println("<body bgcolor=lightyellow>");
sos.println("<table border='1' width='300' cellspacing='0'
cellpadding='2' align='center'>");
sos.println("<caption><b>Shopping cart contents</b></caption>");
sos.println("<tr><th>description</th><th>Price</th><th>Quantity</th></tr>");
Enumeration enum=cart.getEnumeration();
String[] tmpItem;
while(enum.hasMoreElements())
tmpItem=(String[])enum.nextElement();
sos.println("<tr>");
sos.println("<td>"+tmpItem[1]+"</td>");
sos.println("<td align='center'>"+tmpItem[2]+"</td>");
sos.println("<td align='center'>"+tmpItem[3]+"</td></tr>");
sos.println("</table>");
sos.println("</center>");
sos.println("<a href='http://localhost:8080/servlet/Tibre'>Back to
Catalog</a>");
sos.println("</body>");
sos.println("</html>");
catch(Exception e)
e.printStackTrace();
Also please correct me if there are any mistakes in my code.
Thanks for any help
UmaFew errors,
1.Your 'addToCart' method in the bean will not work as you are thinking. Try to find out the reason by yourself.
2.ShopBean cart = new ShopBean(); in your ViewCart servlet gives you a fresh bean with a blank hashtable. Obviously it will not contain any items and hence you are not getting them displayed in the browser. Again you need to find out the error, I can give you a clue, Insert an item in the bean's constructor and test your code.
3.You need to carry the information between your servlets, session is the best thing to use. So, your bean's scope must be session.
Try to solve it by yourself, this forum will always be there to guide you.
Hope this helps.
Sudha -
Hi,
i have a
private Hashtable<IDInterface, String> globalPeerFarmMap_=new Hashtable<IDInterface,String>(); in one class and it can be serialized OK.
In another class, however i have a private Hashtable<IDInterface, PeerBasic> thesePeers_=new Hashtable<IDInterface, PeerBasic>(); and a java.io.NotSerializableException is thrown - on the KeySet it seems.
However, ID (which implements IDInterface) is serializable (and all its fields are serializable) and it works in the first case.
Any ideas? Didn't want to be confusing, but if simplistic i will post some code.
ThanksFound it. The compiler didn't provice much info. Somewhere inside PeerBasic, i call keySet on a Hashtable. I don't understand why this cause a problem.
-
Hi,
i have the following code. the hashtables have been defined at class level.
public void calculateUserDetails()
Enumeration objEnumKeys = hashAllDetails.keys();
while(objEnumKeys.hasMoreElements())
String strHashKey = (String)objEnumKeys.nextElement();
UserDetails objUserDetails = (UserDetails) hashAllDetails.get(strHashKey);
intBasicPacksTotalCount += objUserDetails.CountBasicPacks;
intAdvancedPacksTotalCount += objUserDetails.CountAdvancedPacks;
int intCurrentUserSoldSmsCount = getSoldSmsCountToUser(objUserDetails);
intTotalSoldSmsCount = intTotalSoldSmsCount + intCurrentUserSoldSmsCount;
int intCurrentUserUtilizedSmsCount = intCurrentUserSoldSmsCount - objUserDetails.SmsBalance;
intTotalUtilizedSmsCount += intCurrentUserUtilizedSmsCount;
intActivePacksCount += getUserActiveSMSPacksCount(objUserDetails, intCurrentUserUtilizedSmsCount);
int intTotalCountPackPurchased = packPurchased(objUserDetails);
hashABCD= new Hashtable();
hashABCD.put("tPackPurchased",intTotalCountPackPurchased);
hashABCD.put("UserUtilizedSmsCount",intCurrentUserUtilizedSmsCount);
hashABCD.put("SmsBalance",objUserDetails.SmsBalance);
boolean newFlag=NewUser(objUserDetails);
if(newFlag==true)
hashABCD.put("NewUser","Yes");
else
hashABCD.put("NewUser","No");
hashDisplay.put(objUserDetails.UserId,hashABCD);
} //End while
} UserDetails is my class.
i m getting the folling error.
C:\trainee>javac BulkSmsFunctions.java
BulkSmsFunctions.java:366: cannot resolve symbol
symbol : method put (java.lang.String,int)
location: class java.util.Hashtable
hashABCD.put("TotalCountPackPurchased",intTotalCountPackPurcha
sed);
^
BulkSmsFunctions.java:369: cannot resolve symbol
symbol : method put (java.lang.String,int)
location: class java.util.Hashtable
hashABCD.put("CurrentUserUtilizedSmsCount",intCurrentUserUtili
zedSmsCount);
^
BulkSmsFunctions.java:372: cannot resolve symbol
symbol : method put (java.lang.String,int)
location: class java.util.Hashtable
hashABCD.put("SmsBalance",objUserDetails.SmsBalance);
^
3 errors
please help me out.hi,
Thanks a lot .
Do i wrap int into an integer using
Integer.parseInt() ???
please help.Use the constructor, unless you're using java 1.5, in which a static method valueOf(int) has been introduced. -
How to display the MovieClip in the stage?
My code doesn't work,how to modify?
my code is :
package com.example.programmingas3.mc
import flash.display.MovieClip;
import flash.text.TextField;
import mx.core.UIComponent;
public class MovieClipExample extends UIComponent {
public var mc:MovieClip;
public function MovieClipExample() {
mc=new MovieClip();
var outputText:TextField = new TextField();
outputText.text = getPropertiesString();
outputText.width = 100;
outputText.height = 30;
mc.addChild(outputText);
private function getPropertiesString():String {
var str:String = ""
+ "currentFrame: " + mc.currentFrame + ","
+ "currentLabel: " + mc.currentLabel + ","
+ "currentScene: " + mc.currentScene + ","
+ "framesLoaded: " + mc.framesLoaded + ","
+ "totalFrames: " + mc.totalFrames + ","
+ "trackAsMenu: " + mc.trackAsMenu + ",";
return str;
my mxml code is :
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
xmlns:example="com.example.programmingas3.mc.*"
xmlns="*"
paddingTop="0"
width="100%"
height="100%"
layout="vertical" >
<mx:Panel width="550" height="400" layout="absolute">
<example:MovieClipExample id="myMovie" width="500"
height="300" >
</example:MovieClipExample>
</mx:Panel>
</mx:Application>
Maybe you are looking for
-
Change encrypted sparsebindle password
I have an encrypted sparsebundle. I need to change the passphrase. How can I do that?
-
TXTing from iPhone to Droid (one sentence/line at a time)
I have an iPhone 6, when I txt a friend who has a Droid, she receives one line at a time instead of the entire paragraph. Only with me, not her daughter who also has an iPhone. Any ideas what the problem might be?
-
Hi, can anyone help? The artwork on the first 32 albums in a collection of about 1,100 have mysteriously changed to a single artist (Wanda Jackson) I have recently added to my collection. This album was "ripped "from a CD, as are most of my albums. A
-
VL09 hit error 'F5 727 ("Maximum number of items in FI reached")'
Hi, I have one user who is trying to cancel GI for DO using transaction VL09 and hit the error 'F5 727 ("Maximum number of items in FI reached")'. I know it is caused by FI document maximum item no is hit. Is there a solution to cancel this GI docu
-
Viewing iMovies, created on PowerBook, on MacBook Pro
I'm trying to watch several imovies on my Macbook Pro, which won't support them. They were created on my retired PowerBook . I'm using Lion 10.7.5. Can someone advise on how I can access these movies?