meow00
asked on
entity bean ...
Hi Experts,
I created an entity bean from a MS Access database using Blazix12. I got three java(tm) files and a script. However, I couldn't compile any of them. So .... why is that ? Am I supposed to compile a bean ? the following are the java files ....
please help ! Thanks !
meow.
-------------------------- --
// Props.java
package props;
// File generated by Desiderata Software's Blazix entity bean wizard
// Sun Sep 05 01:25:59 PDT 2004
// Remote interface for entity bean "Props"
import javax.ejb.*;
import java.rmi.*;
public interface Props extends javax.ejb.EJBObject {
java.lang.String getKey() throws java.rmi.RemoteException;
java.lang.String getValue() throws java.rmi.RemoteException;
void setValue( java.lang.String value ) throws java.rmi.RemoteException;
// TBD: Add any additional remote method interfaces
//
}
-------------------------
// PropsBean
package props;
// File generated by Desiderata Software's Blazix entity bean wizard
// Sun Sep 05 01:25:59 PDT 2004
// Bean class for entity bean "Props"
import javax.ejb.*;
import javax.naming.*;
import java.rmi.*;
public class PropsBean implements javax.ejb.EntityBean {
//Instance member variables.
//
public java.lang.String key = null;
public java.lang.String value = null;
// Entity context, can be used to obtain handles etc
//
javax.ejb.EntityContext ejbEntityContext = null;
//Getter/setter methods
//
public java.lang.String getKey() throws java.rmi.RemoteException
{
return key;
}
public java.lang.String getValue() throws java.rmi.RemoteException
{
return value;
}
public void setValue( java.lang.String value ) throws java.rmi.RemoteException
{
this.value = value;
}
// TBD: Add implementations for any additional remote method interfaces
//
// The default ejbCreate method.
//
public java.lang.String ejbCreate(
java.lang.String key,
java.lang.String value
)
throws javax.ejb.CreateException, java.rmi.RemoteException
{
this.key = key;
this.value = value;
return null;
}
// TBD: If any other ejbCreate's are added manually to the home interface, define them.
//
// Other methods required in an entity bean
//
public void setEntityContext( javax.ejb.EntityContext ejbEntityContext )
throws RemoteException
{
this.ejbEntityContext = ejbEntityContext;
}
public void unsetEntityContext()
throws RemoteException
{
this.ejbEntityContext = null;
}
public void ejbPostCreate(
java.lang.String key,
java.lang.String value
)
{
// TBD: Do any post-instance-creation processing here
}
public void ejbRemove()
throws java.rmi.RemoteException, javax.ejb.RemoveException
{
// TBD: Do any processing here when instance is being removed
}
public void ejbActivate()
throws java.rmi.RemoteException
{
// TBD: Do any processing here when instance is activated
}
public void ejbPassivate()
throws java.rmi.RemoteException
{
// TBD: Do any processing here when instance is being passivated
}
public void ejbLoad()
throws java.rmi.RemoteException
{
// TBD: Load any data needed by instance
// in addition to the container-managed data.
}
public void ejbStore()
throws java.rmi.RemoteException
{
// TBD: Store any data used by instance
// in addition to the container-managed data.
}
}
-------------------------- -----
// PropsHome
package props;
// File generated by Desiderata Software's Blazix entity bean wizard
// Sun Sep 05 01:25:59 PDT 2004
// Home interface for entity bean "Props"
import javax.ejb.*;
import java.rmi.*;
import java.util.*;
public interface PropsHome extends javax.ejb.EJBHome {
Props create(
java.lang.String key,
java.lang.String value
) throws javax.ejb.CreateException, java.rmi.RemoteException;
Props findByPrimaryKey( java.lang.String pkey ) throws javax.ejb.FinderException, java.rmi.RemoteException;
}
I created an entity bean from a MS Access database using Blazix12. I got three java(tm) files and a script. However, I couldn't compile any of them. So .... why is that ? Am I supposed to compile a bean ? the following are the java files ....
please help ! Thanks !
meow.
--------------------------
// Props.java
package props;
// File generated by Desiderata Software's Blazix entity bean wizard
// Sun Sep 05 01:25:59 PDT 2004
// Remote interface for entity bean "Props"
import javax.ejb.*;
import java.rmi.*;
public interface Props extends javax.ejb.EJBObject {
java.lang.String getKey() throws java.rmi.RemoteException;
java.lang.String getValue() throws java.rmi.RemoteException;
void setValue( java.lang.String value ) throws java.rmi.RemoteException;
// TBD: Add any additional remote method interfaces
//
}
-------------------------
// PropsBean
package props;
// File generated by Desiderata Software's Blazix entity bean wizard
// Sun Sep 05 01:25:59 PDT 2004
// Bean class for entity bean "Props"
import javax.ejb.*;
import javax.naming.*;
import java.rmi.*;
public class PropsBean implements javax.ejb.EntityBean {
//Instance member variables.
//
public java.lang.String key = null;
public java.lang.String value = null;
// Entity context, can be used to obtain handles etc
//
javax.ejb.EntityContext ejbEntityContext = null;
//Getter/setter methods
//
public java.lang.String getKey() throws java.rmi.RemoteException
{
return key;
}
public java.lang.String getValue() throws java.rmi.RemoteException
{
return value;
}
public void setValue( java.lang.String value ) throws java.rmi.RemoteException
{
this.value = value;
}
// TBD: Add implementations for any additional remote method interfaces
//
// The default ejbCreate method.
//
public java.lang.String ejbCreate(
java.lang.String key,
java.lang.String value
)
throws javax.ejb.CreateException,
{
this.key = key;
this.value = value;
return null;
}
// TBD: If any other ejbCreate's are added manually to the home interface, define them.
//
// Other methods required in an entity bean
//
public void setEntityContext( javax.ejb.EntityContext ejbEntityContext )
throws RemoteException
{
this.ejbEntityContext = ejbEntityContext;
}
public void unsetEntityContext()
throws RemoteException
{
this.ejbEntityContext = null;
}
public void ejbPostCreate(
java.lang.String key,
java.lang.String value
)
{
// TBD: Do any post-instance-creation processing here
}
public void ejbRemove()
throws java.rmi.RemoteException, javax.ejb.RemoveException
{
// TBD: Do any processing here when instance is being removed
}
public void ejbActivate()
throws java.rmi.RemoteException
{
// TBD: Do any processing here when instance is activated
}
public void ejbPassivate()
throws java.rmi.RemoteException
{
// TBD: Do any processing here when instance is being passivated
}
public void ejbLoad()
throws java.rmi.RemoteException
{
// TBD: Load any data needed by instance
// in addition to the container-managed data.
}
public void ejbStore()
throws java.rmi.RemoteException
{
// TBD: Store any data used by instance
// in addition to the container-managed data.
}
}
--------------------------
// PropsHome
package props;
// File generated by Desiderata Software's Blazix entity bean wizard
// Sun Sep 05 01:25:59 PDT 2004
// Home interface for entity bean "Props"
import javax.ejb.*;
import java.rmi.*;
import java.util.*;
public interface PropsHome extends javax.ejb.EJBHome {
Props create(
java.lang.String key,
java.lang.String value
) throws javax.ejb.CreateException,
Props findByPrimaryKey( java.lang.String pkey ) throws javax.ejb.FinderException,
}
What is the script btw?
Make sure you have a j2ee jar in your classpath, either from installing J2EE or from your container.
What is the error when compiling?
ASKER
Hi CEHJ,
This is the script:
javac -d "C:\Documents and Settings\Meow\Ejbtut" "C:\Documents and Settings\Meow\Ejbtut\Props Home.java" "C:\Documents and Settings\Meow\Ejbtut\Props .java" "C:\Documents and Settings\Meow\Ejbtut\Props Bean.java" jar -cvf Props.jar -C "C:\Documents and Settings\Meow\Ejbtut" META-INF/ejb-jar.xml "props/PropsHome.class" "props/Props.class" "props/PropsBean.class"
blxejbc Props.jar PropsEjb.jar
-------------------------- ---------- ---------- ---------- ---------- ------
Hi object,
Where to check the classpath ? I am not sure whether I have installed J2EE .. how do I check this ?
-------------------------- ---------- ---------- ---------- ---
Hi sompol_kiatkamolchai,
Ejbtut/Props.java [8:1] package javax.ejb does not exist
import javax.ejb.*;
^
Ejbtut/Props.java [11:1] package javax.ejb does not exist
public interface Props extends javax.ejb.EJBObject {
^
2 errors
Errors compiling Props.
This is the script:
javac -d "C:\Documents and Settings\Meow\Ejbtut" "C:\Documents and Settings\Meow\Ejbtut\Props
blxejbc Props.jar PropsEjb.jar
--------------------------
Hi object,
Where to check the classpath ? I am not sure whether I have installed J2EE .. how do I check this ?
--------------------------
Hi sompol_kiatkamolchai,
Ejbtut/Props.java [8:1] package javax.ejb does not exist
import javax.ejb.*;
^
Ejbtut/Props.java [11:1] package javax.ejb does not exist
public interface Props extends javax.ejb.EJBObject {
^
2 errors
Errors compiling Props.
It'sure that you don't have library(j2ee.jar). I will find the link for you to download.
After installing, please find j2ee.jar and include to classpath.
ASKER
Hi sompol_kiatkamolchai & experts,
I have j2ee.jar at C:\j2sdkee1.3\lib
It is version 1.3 rather than version 1.4. Can I use this one ? Thanks !
I have j2ee.jar at C:\j2sdkee1.3\lib
It is version 1.3 rather than version 1.4. Can I use this one ? Thanks !
ASKER
Hi Experts,
I checked my computer, and I do have my setting as :
-------------------------- ---------- ---------- ---------- ---------- ---
path :
C:\j2sdkee1.3\bin; C:\jdk1.3.1\bin; C:\Program Files\Microsoft Visual Studio\Common\Tools\WinNT; C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin; C:\Program Files\Microsoft Visual Studio\Common\Tools;C:\Pro gram Files\Microsoft Visual Studio\VC98\bin;
&
CLASSPATH :
.;%J2EE_HOME%\lib\j2ee.jar ;%J2EE_HOM E%\lib\loc ale
-------------------------- ---------- ---------- ----
Did I make any mistake in the setting ? Thanks !
I checked my computer, and I do have my setting as :
--------------------------
path :
C:\j2sdkee1.3\bin; C:\jdk1.3.1\bin; C:\Program Files\Microsoft Visual Studio\Common\Tools\WinNT;
&
CLASSPATH :
.;%J2EE_HOME%\lib\j2ee.jar
--------------------------
Did I make any mistake in the setting ? Thanks !
Your script may set a new classpath to CLASSPATH variable.
Try to modify script to
javac -classpath="c:\j2sdkee1.3\ lib\j2ee.j ar" -d "C:\Documents and Settings\Meow\Ejbtut" "C:\Documents and Settings\Meow\Ejbtut\Props Home.java" "C:\Documents and Settings\Meow\Ejbtut\Props .java" "C:\Documents and Settings\Meow\Ejbtut\Props Bean.java" jar -cvf Props.jar -C "C:\Documents and Settings\Meow\Ejbtut" META-INF/ejb-jar.xml "props/PropsHome.class" "props/Props.class" "props/PropsBean.class"
blxejbc Props.jar PropsEjb.jar
I add -classpath="c:\j2sdkee1.3\ lib\j2ee.j ar" to javac
Try to modify script to
javac -classpath="c:\j2sdkee1.3\
blxejbc Props.jar PropsEjb.jar
I add -classpath="c:\j2sdkee1.3\
ASKER
err ..... I tried to change the script to the above one ... but I still get the same errors ......
..... what else should I check now ? please help !!!
meow ....
..... what else should I check now ? please help !!!
meow ....
>> CLASSPATH :
>> .;%J2EE_HOME%\lib\j2ee.jar ;%J2EE_HOM E%\lib\loc ale
And what is J2EE_HOME set to?
>> .;%J2EE_HOME%\lib\j2ee.jar
And what is J2EE_HOME set to?
ASKER
Hi,
Here they are :
J2EE_HOME : C:\j2sdkee1.3
JAVA_HOME : C:\jdk1.3.1
Here they are :
J2EE_HOME : C:\j2sdkee1.3
JAVA_HOME : C:\jdk1.3.1
Try to narrow down the problem. To make sure that the problem is not from script. Try to compile it manually file by file, and to make sure that it is not the problem from single space in path copy *.java to a new folder e.g. temp
-go to command prompt c:\temp
-c:\temp\>set classpath=%classpath%;c:\j 2sdkee1.3\ lib\j2ee.j ar
-c:\temp\>javac Props.java
and see what is the output?
-go to command prompt c:\temp
-c:\temp\>set classpath=%classpath%;c:\j
-c:\temp\>javac Props.java
and see what is the output?
Yes. J2EE_HOME should set to c:\j2sdkee1.3. You head to the right way.
>> CLASSPATH
>> .;%J2EE_HOME%\lib\j2ee.jar ;%J2EE_HOM E%\lib\loc ale
Try making it:
%J2EE_HOME%\lib\j2ee.jar;% J2EE_HOME% \lib\local e;.
>> .;%J2EE_HOME%\lib\j2ee.jar
Try making it:
%J2EE_HOME%\lib\j2ee.jar;%
ASKER
Hi sompol_kiatkamolchai & experts,
It seems that the problem is in PropsHome.java ..... I compiled it manually, and the following is the output ....
So ... how do I fix this problem ??? Thanks a lot !
-------------------------- ---------- ---------- ---------- ---------- ---
C:\Documents and Settings\meow\temp>dir
Volume in drive C has no label.
Volume Serial Number is 0000-042C
Directory of C:\Documents and Settings\meow\temp
2004/09/05 下午 09:24 <DIR> .
2004/09/05 下午 09:24 <DIR> ..
2004/09/05 上午 01:25 531 Props.java
2004/09/05 上午 01:25 2,552 PropsBean.java
2004/09/05 上午 01:25 542 PropsHome.java
3 File(s) 3,625 bytes
2 Dir(s) 16,670,085,120 bytes free
C:\Documents and Settings\meow\temp>set classpath=%classpath%;c:\j 2sdkee1.3\ lib\j2ee.j ar
C:\Documents and Settings\meow\temp>javac Props.java
C:\Documents and Settings\meow\temp>dir
Volume in drive C has no label.
Volume Serial Number is 0000-042C
Directory of C:\Documents and Settings\meow\temp
2004/09/05 下午 09:25 <DIR> .
2004/09/05 下午 09:25 <DIR> ..
2004/09/05 下午 09:25 299 Props.class
2004/09/05 上午 01:25 531 Props.java
2004/09/05 上午 01:25 2,552 PropsBean.java
2004/09/05 上午 01:25 542 PropsHome.java
4 File(s) 3,924 bytes
2 Dir(s) 16,670,081,024 bytes free
C:\Documents and Settings\meow\temp>javac PropsBean.java
C:\Documents and Settings\meow\temp>javac PropsHome.java
PropsHome.java:13: cannot resolve symbol
symbol : class Props
location: interface props.PropsHome
Props create(
^
PropsHome.java:18: cannot resolve symbol
symbol : class Props
location: interface props.PropsHome
Props findByPrimaryKey( java.lang.String pkey ) throws javax.ejb.FinderE
xception, java.rmi.RemoteException;
^
2 errors
It seems that the problem is in PropsHome.java ..... I compiled it manually, and the following is the output ....
So ... how do I fix this problem ??? Thanks a lot !
--------------------------
C:\Documents and Settings\meow\temp>dir
Volume in drive C has no label.
Volume Serial Number is 0000-042C
Directory of C:\Documents and Settings\meow\temp
2004/09/05 下午 09:24 <DIR> .
2004/09/05 下午 09:24 <DIR> ..
2004/09/05 上午 01:25 531 Props.java
2004/09/05 上午 01:25 2,552 PropsBean.java
2004/09/05 上午 01:25 542 PropsHome.java
3 File(s) 3,625 bytes
2 Dir(s) 16,670,085,120 bytes free
C:\Documents and Settings\meow\temp>set classpath=%classpath%;c:\j
C:\Documents and Settings\meow\temp>javac Props.java
C:\Documents and Settings\meow\temp>dir
Volume in drive C has no label.
Volume Serial Number is 0000-042C
Directory of C:\Documents and Settings\meow\temp
2004/09/05 下午 09:25 <DIR> .
2004/09/05 下午 09:25 <DIR> ..
2004/09/05 下午 09:25 299 Props.class
2004/09/05 上午 01:25 531 Props.java
2004/09/05 上午 01:25 2,552 PropsBean.java
2004/09/05 上午 01:25 542 PropsHome.java
4 File(s) 3,924 bytes
2 Dir(s) 16,670,081,024 bytes free
C:\Documents and Settings\meow\temp>javac PropsBean.java
C:\Documents and Settings\meow\temp>javac PropsHome.java
PropsHome.java:13: cannot resolve symbol
symbol : class Props
location: interface props.PropsHome
Props create(
^
PropsHome.java:18: cannot resolve symbol
symbol : class Props
location: interface props.PropsHome
Props findByPrimaryKey( java.lang.String pkey ) throws javax.ejb.FinderE
xception, java.rmi.RemoteException;
^
2 errors
Change
C:\Documents and Settings\meow\temp>set classpath=%classpath%;c:\j 2sdkee1.3\ lib\j2ee.j ar
to
C:\Documents and Settings\meow\temp>set classpath=.;%classpath%;c: \j2sdkee1. 3\lib\j2ee .jar
If there are still error, dump Props.java, I think there is error from package name.
C:\Documents and Settings\meow\temp>set classpath=%classpath%;c:\j
to
C:\Documents and Settings\meow\temp>set classpath=.;%classpath%;c:
If there are still error, dump Props.java, I think there is error from package name.
ASKER
Hi sompol_kiatkamolchai,
there are still errors as follows ..... so ... is there still a way to fix it ? Thanks !
-------------------------- ---------- ---------- ---------- ---------- -------
C:\Documents and Settings\meow\temp>set classpath=.;%classpath%;c: \j2sdkee1. 3\lib\j2ee .jar
C:\Documents and Settings\meow\temp>javac PropsHome.java
PropsHome.java:13: cannot resolve symbol
symbol : class Props
location: interface props.PropsHome
Props create(
^
PropsHome.java:18: cannot resolve symbol
symbol : class Props
location: interface props.PropsHome
Props findByPrimaryKey( java.lang.String pkey ) throws javax.ejb.FinderE
xception, java.rmi.RemoteException;
^
2 errors
there are still errors as follows ..... so ... is there still a way to fix it ? Thanks !
--------------------------
C:\Documents and Settings\meow\temp>set classpath=.;%classpath%;c:
C:\Documents and Settings\meow\temp>javac PropsHome.java
PropsHome.java:13: cannot resolve symbol
symbol : class Props
location: interface props.PropsHome
Props create(
^
PropsHome.java:18: cannot resolve symbol
symbol : class Props
location: interface props.PropsHome
Props findByPrimaryKey( java.lang.String pkey ) throws javax.ejb.FinderE
xception, java.rmi.RemoteException;
^
2 errors
please dump Props.java and PropsHome.java, I think there are missing import statement or package name not defined in Props.java
There should be
C:\Documents and Settings\meow\temp\props\P rops.class
If not, I think there are no, or missing package name in Props.java
Open Props.java and see in the header there should be something like this
package props;
C:\Documents and Settings\meow\temp\props\P
If not, I think there are no, or missing package name in Props.java
Open Props.java and see in the header there should be something like this
package props;
ASKER
Thanks for the info ...
so what does it mean by "dump Props.java and PropsHome.java" ? does it mean delete or something else ?
also here is Props.java :
-------------------------- ---------- ---------- ---------- -
package props;
// File generated by Desiderata Software's Blazix entity bean wizard
// Sun Sep 05 01:25:59 PDT 2004
// Remote interface for entity bean "Props"
import javax.ejb.*;
import java.rmi.*;
public interface Props extends javax.ejb.EJBObject {
java.lang.String getKey() throws java.rmi.RemoteException;
java.lang.String getValue() throws java.rmi.RemoteException;
void setValue( java.lang.String value ) throws java.rmi.RemoteException;
// TBD: Add any additional remote method interfaces
//
}
-------------------
please help !!! Thanks !!!
so what does it mean by "dump Props.java and PropsHome.java" ? does it mean delete or something else ?
also here is Props.java :
--------------------------
package props;
// File generated by Desiderata Software's Blazix entity bean wizard
// Sun Sep 05 01:25:59 PDT 2004
// Remote interface for entity bean "Props"
import javax.ejb.*;
import java.rmi.*;
public interface Props extends javax.ejb.EJBObject {
java.lang.String getKey() throws java.rmi.RemoteException;
java.lang.String getValue() throws java.rmi.RemoteException;
void setValue( java.lang.String value ) throws java.rmi.RemoteException;
// TBD: Add any additional remote method interfaces
//
}
-------------------
please help !!! Thanks !!!
dump mean paste or post to this question. :)
Your code looks fine. Could you please post all files? I think the answer almost come.
Your code looks fine. Could you please post all files? I think the answer almost come.
OK. I see you source in the question, I will try to compile too.
!! I can compile it.
> C:\Documents and Settings\meow\temp
your source code is in the wrong directory, as you are using the package props it needs to be a props directory.
Try renaming temp to props, so you code is then in:
C:\Documents and Settings\meow\props
and add C:\Documents and Settings\meow\ to your classpath
your source code is in the wrong directory, as you are using the package props it needs to be a props directory.
Try renaming temp to props, so you code is then in:
C:\Documents and Settings\meow\props
and add C:\Documents and Settings\meow\ to your classpath
C:\Documents and Settings\sompol\temp>dir
Volume in drive C has no label.
Volume Serial Number is DCD9-B5B7
Directory of C:\Documents and Settings\sompol\temp
09/06/2004 12:47 PM <DIR> .
09/06/2004 12:47 PM <DIR> ..
09/06/2004 12:42 PM 551 Props.java
09/06/2004 12:42 PM 2,996 PropsBean.java
09/06/2004 12:43 PM 586 PropsHome.java
3 File(s) 4,133 bytes
2 Dir(s) 23,759,470,592 bytes free
C:\Documents and Settings\sompol\temp>set classpath=.;C:\Sun\AppServ er\lib\j2e e.
jar
C:\Documents and Settings\sompol\temp>javac *.java
C:\Documents and Settings\sompol\temp>dir
Volume in drive C has no label.
Volume Serial Number is DCD9-B5B7
Directory of C:\Documents and Settings\sompol\temp
09/06/2004 12:47 PM <DIR> .
09/06/2004 12:47 PM <DIR> ..
09/06/2004 12:47 PM 299 Props.class
09/06/2004 12:42 PM 551 Props.java
09/06/2004 12:47 PM 1,470 PropsBean.class
09/06/2004 12:42 PM 2,996 PropsBean.java
09/06/2004 12:47 PM 393 PropsHome.class
09/06/2004 12:43 PM 586 PropsHome.java
6 File(s) 6,295 bytes
2 Dir(s) 23,759,466,496 bytes free
C:\Documents and Settings\sompol\temp>
Volume in drive C has no label.
Volume Serial Number is DCD9-B5B7
Directory of C:\Documents and Settings\sompol\temp
09/06/2004 12:47 PM <DIR> .
09/06/2004 12:47 PM <DIR> ..
09/06/2004 12:42 PM 551 Props.java
09/06/2004 12:42 PM 2,996 PropsBean.java
09/06/2004 12:43 PM 586 PropsHome.java
3 File(s) 4,133 bytes
2 Dir(s) 23,759,470,592 bytes free
C:\Documents and Settings\sompol\temp>set classpath=.;C:\Sun\AppServ
jar
C:\Documents and Settings\sompol\temp>javac
C:\Documents and Settings\sompol\temp>dir
Volume in drive C has no label.
Volume Serial Number is DCD9-B5B7
Directory of C:\Documents and Settings\sompol\temp
09/06/2004 12:47 PM <DIR> .
09/06/2004 12:47 PM <DIR> ..
09/06/2004 12:47 PM 299 Props.class
09/06/2004 12:42 PM 551 Props.java
09/06/2004 12:47 PM 1,470 PropsBean.class
09/06/2004 12:42 PM 2,996 PropsBean.java
09/06/2004 12:47 PM 393 PropsHome.class
09/06/2004 12:43 PM 586 PropsHome.java
6 File(s) 6,295 bytes
2 Dir(s) 23,759,466,496 bytes free
C:\Documents and Settings\sompol\temp>
type set classpath
c:\....>set classpath
and paste the output here. I think you may not include . to classpath
c:\....>set classpath
and paste the output here. I think you may not include . to classpath
> I think you may not include . to classpath
Not necessary if you include the location of the source tree as I specified above
Not necessary if you include the location of the source tree as I specified above
ASKER
Hi sompol_kiatkamolchai & experts,
here it is :
C:\Documents and Settings\meow\temp>set classpath
CLASSPATH=.;C:\j2sdkee1.3\ lib\j2ee.j ar;C:\j2sd kee1.3\lib \locale
thanks.
here it is :
C:\Documents and Settings\meow\temp>set classpath
CLASSPATH=.;C:\j2sdkee1.3\
thanks.
ASKER
okay .... it seems that :
If I compile the code seperately, it won't work ....
i.e. javac Props.java ; javac PropsBean.java; javac PropsHome.java
But if I do javac *.java .... it works !!! (anyone happen to know why ?)
thanks very much for all your helps !
Thanks a lot !
If I compile the code seperately, it won't work ....
i.e. javac Props.java ; javac PropsBean.java; javac PropsHome.java
But if I do javac *.java .... it works !!! (anyone happen to know why ?)
thanks very much for all your helps !
Thanks a lot !
Did you get Props.class after compiling? Try and check it again.
C:\Documents and Settings\sompol\temp>del *.class
C:\Documents and Settings\sompol\temp>javac Props.java
C:\Documents and Settings\sompol\temp>dir
Volume in drive C has no label.
Volume Serial Number is DCD9-B5B7
Directory of C:\Documents and Settings\sompol\temp
09/06/2004 01:46 PM <DIR> .
09/06/2004 01:46 PM <DIR> ..
09/06/2004 01:46 PM 299 Props.class <-- Please check after compiling Props.java, it must have this file
09/06/2004 12:42 PM 551 Props.java
09/06/2004 12:42 PM 2,996 PropsBean.java
09/06/2004 12:43 PM 586 PropsHome.java
4 File(s) 4,432 bytes
2 Dir(s) 23,757,373,440 bytes free
C:\Documents and Settings\sompol\temp>del *.class
C:\Documents and Settings\sompol\temp>javac
C:\Documents and Settings\sompol\temp>dir
Volume in drive C has no label.
Volume Serial Number is DCD9-B5B7
Directory of C:\Documents and Settings\sompol\temp
09/06/2004 01:46 PM <DIR> .
09/06/2004 01:46 PM <DIR> ..
09/06/2004 01:46 PM 299 Props.class <-- Please check after compiling Props.java, it must have this file
09/06/2004 12:42 PM 551 Props.java
09/06/2004 12:42 PM 2,996 PropsBean.java
09/06/2004 12:43 PM 586 PropsHome.java
4 File(s) 4,432 bytes
2 Dir(s) 23,757,373,440 bytes free
As long as you're compiling in the correct order, I don't see an issue with it. Exactly which order did you compile them separately?
Have you changed the name of the directory your files are in as I mentioned above?
add then add C:\Documents and Settings\meow\ to your classpath
> If I compile the code seperately, it won't work ....
The above changes will fix that.
add then add C:\Documents and Settings\meow\ to your classpath
> If I compile the code seperately, it won't work ....
The above changes will fix that.
I think the Props.class will get created in a props folder.
By default, after compiling,java compiler will generate .class in that directory if we don't specify output dir.
And when we try to compile PropsHome.java it refers to Props.class that should be in sub folder props.
And when we try to compile PropsHome.java it refers to Props.class that should be in sub folder props.
>> after compiling,java compiler will generate .class in that directory if we don't specify output dir
What I meant was that, since the package-name is props, it should be: root/props/Props.class
What I meant was that, since the package-name is props, it should be: root/props/Props.class
Try this
javac -d . Props.java
javac -d . PropsBean.java
javac -d . PropsHome.java
It will automatically create folder as package name specified.
javac -d . Props.java
javac -d . PropsBean.java
javac -d . PropsHome.java
It will automatically create folder as package name specified.
Yes. We mention to the same thing but I don't copy from you. I posted it just after you 4 seconds.
>> but I don't copy from you.
I know ;-)
I know ;-)
> since the package-name is props, it should be: root/props/Props.class
Already mentioned that a couple of times earlier.
> javac -d . Props.java
-d option is unnecessary unless you want to put the classes in a seperate directory, which I don't think is the case here.
Already mentioned that a couple of times earlier.
> javac -d . Props.java
-d option is unnecessary unless you want to put the classes in a seperate directory, which I don't think is the case here.
>> Already mentioned that a couple of times earlier.
I was answering to:
>> Please check after compiling Props.java, it must have this file
I meant that it should be in a props folder.
I was answering to:
>> Please check after compiling Props.java, it must have this file
I meant that it should be in a props folder.
>javac -d . Props.java
It's just adhoc solution for this question because when I use
javac Props.java
it creates Props.class at the same directory Props.java
So If we don't specify, we would move it manually.
It's just adhoc solution for this question because when I use
javac Props.java
it creates Props.class at the same directory Props.java
So If we don't specify, we would move it manually.
> It's just adhoc solution for this question
Better to fix it properly :)
Better to fix it properly :)
ASKER
Hi sompol_kiatkamolchai & experts,
I do have *.class for every *.java file if I do javac *.java. However, it does not work if I compile them one by one. Also, they just can't compile using .netbean.
Hi object,
I did change temp to props and include the classpath. It works fine if I try to compile using javac *.java, but it didn't work if I try to compile it one by one.... it refuses to work in the .netbean as well ...
I do have *.class for every *.java file if I do javac *.java. However, it does not work if I compile them one by one. Also, they just can't compile using .netbean.
Hi object,
I did change temp to props and include the classpath. It works fine if I try to compile using javac *.java, but it didn't work if I try to compile it one by one.... it refuses to work in the .netbean as well ...
> I did change temp to props and include the classpath
post the current directory structure and your classpath.
post the current directory structure and your classpath.
Do you try
javac -d . Props.java
javac -d . PropsBean.java
javac -d . PropsHome.java
javac -d . Props.java
javac -d . PropsBean.java
javac -d . PropsHome.java
ASKER
Hi Experts,
Here is the directories :
-------------------------- ---------- ---------- ---------- -----
C:\Documents and Settings\meow\My Documents\Ejbtut>dir
Volume in drive C has no label.
Volume Serial Number is 0000-042C
Directory of C:\Documents and Settings\meow\My Documents\Ejbtut
2004/09/06 上午 12:37 <DIR> .
2004/09/06 上午 12:37 <DIR> ..
2004/09/05 上午 06:02 340 .nbattrs
2004/09/05 下午 08:57 515 build.cmd
2004/09/05 上午 01:25 <DIR> META-INF
2004/09/05 下午 06:32 <DIR> props
2004/09/05 下午 06:32 2,350 Props.jar
2004/09/05 上午 01:25 531 Props.java
2004/09/05 上午 01:25 2,552 PropsBean.java
2004/09/05 上午 01:25 542 PropsHome.java
6 File(s) 6,830 bytes
4 Dir(s) 16,669,421,568 bytes free
C:\Documents and Settings\meow\My Documents\Ejbtut>cd props
C:\Documents and Settings\meow\My Documents\Ejbtut\props>dir
Volume in drive C has no label.
Volume Serial Number is 0000-042C
Directory of C:\Documents and Settings\meow\My Documents\Ejbtut\props
2004/09/05 下午 06:32 <DIR> .
2004/09/05 下午 06:32 <DIR> ..
2004/09/05 下午 06:32 299 Props.class
2004/09/05 下午 06:32 1,474 PropsBean.class
2004/09/05 下午 06:32 393 PropsHome.class
3 File(s) 2,166 bytes
2 Dir(s) 16,669,421,568 bytes free
C:\Documents and Settings\meow\My Documents\Ejbtut\props>
-------------------------- ---------- ---------- ---------- ---------- ---------
and all the path :
CLASSPATH :
.;%J2EE_HOME%\lib\j2ee.jar ;%J2EE_HOM E%\lib\loc ale;C:\Doc uments and Settings\meow\My Documents\Ejbtut
path :
C:\j2sdkee1.3\bin; C:\jdk1.3.1\bin; C:\Program Files\Microsoft Visual Studio\Common\Tools\WinNT; C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin; C:\Program Files\Microsoft Visual Studio\Common\Tools;C:\Pro gram Files\Microsoft Visual Studio\VC98\bin;
J2EE_HOME :
j2sdkee1.3
JAVA_HOME :
jdk1.3.1
-------------------------- -----
current errors from .netbean :
Ejbtut/PropsBean.java [8:1] package javax.ejb does not exist
import javax.ejb.*;
^
Ejbtut/PropsBean.java [12:1] package javax.ejb does not exist
public class PropsBean implements javax.ejb.EntityBean {
^
Ejbtut/PropsBean.java [22:1] package javax.ejb does not exist
javax.ejb.EntityContext ejbEntityContext = null;
^
Ejbtut/PropsBean.java [52:1] package javax.ejb does not exist
throws javax.ejb.CreateException, java.rmi.RemoteException
^
Ejbtut/PropsBean.java [65:1] package javax.ejb does not exist
public void setEntityContext( javax.ejb.EntityContext ejbEntityContext )
^
Ejbtut/PropsBean.java [87:1] package javax.ejb does not exist
throws java.rmi.RemoteException, javax.ejb.RemoveException
^
Ejbtut/Props.java [8:1] package javax.ejb does not exist
import javax.ejb.*;
^
Ejbtut/Props.java [11:1] package javax.ejb does not exist
public interface Props extends javax.ejb.EJBObject {
^
Ejbtut/PropsHome.java [8:1] package javax.ejb does not exist
import javax.ejb.*;
^
Ejbtut/PropsHome.java [12:1] package javax.ejb does not exist
public interface PropsHome extends javax.ejb.EJBHome {
^
Ejbtut/PropsHome.java [16:1] package javax.ejb does not exist
) throws javax.ejb.CreateException, java.rmi.RemoteException;
^
Ejbtut/PropsHome.java [18:1] package javax.ejb does not exist
Props findByPrimaryKey( java.lang.String pkey ) throws javax.ejb.FinderException, java.rmi.RemoteException;
^
12 errors
Errors compiling Ejbtut.
Here is the directories :
--------------------------
C:\Documents and Settings\meow\My Documents\Ejbtut>dir
Volume in drive C has no label.
Volume Serial Number is 0000-042C
Directory of C:\Documents and Settings\meow\My Documents\Ejbtut
2004/09/06 上午 12:37 <DIR> .
2004/09/06 上午 12:37 <DIR> ..
2004/09/05 上午 06:02 340 .nbattrs
2004/09/05 下午 08:57 515 build.cmd
2004/09/05 上午 01:25 <DIR> META-INF
2004/09/05 下午 06:32 <DIR> props
2004/09/05 下午 06:32 2,350 Props.jar
2004/09/05 上午 01:25 531 Props.java
2004/09/05 上午 01:25 2,552 PropsBean.java
2004/09/05 上午 01:25 542 PropsHome.java
6 File(s) 6,830 bytes
4 Dir(s) 16,669,421,568 bytes free
C:\Documents and Settings\meow\My Documents\Ejbtut>cd props
C:\Documents and Settings\meow\My Documents\Ejbtut\props>dir
Volume in drive C has no label.
Volume Serial Number is 0000-042C
Directory of C:\Documents and Settings\meow\My Documents\Ejbtut\props
2004/09/05 下午 06:32 <DIR> .
2004/09/05 下午 06:32 <DIR> ..
2004/09/05 下午 06:32 299 Props.class
2004/09/05 下午 06:32 1,474 PropsBean.class
2004/09/05 下午 06:32 393 PropsHome.class
3 File(s) 2,166 bytes
2 Dir(s) 16,669,421,568 bytes free
C:\Documents and Settings\meow\My Documents\Ejbtut\props>
--------------------------
and all the path :
CLASSPATH :
.;%J2EE_HOME%\lib\j2ee.jar
path :
C:\j2sdkee1.3\bin; C:\jdk1.3.1\bin; C:\Program Files\Microsoft Visual Studio\Common\Tools\WinNT;
J2EE_HOME :
j2sdkee1.3
JAVA_HOME :
jdk1.3.1
--------------------------
current errors from .netbean :
Ejbtut/PropsBean.java [8:1] package javax.ejb does not exist
import javax.ejb.*;
^
Ejbtut/PropsBean.java [12:1] package javax.ejb does not exist
public class PropsBean implements javax.ejb.EntityBean {
^
Ejbtut/PropsBean.java [22:1] package javax.ejb does not exist
javax.ejb.EntityContext ejbEntityContext = null;
^
Ejbtut/PropsBean.java [52:1] package javax.ejb does not exist
throws javax.ejb.CreateException,
^
Ejbtut/PropsBean.java [65:1] package javax.ejb does not exist
public void setEntityContext( javax.ejb.EntityContext ejbEntityContext )
^
Ejbtut/PropsBean.java [87:1] package javax.ejb does not exist
throws java.rmi.RemoteException, javax.ejb.RemoveException
^
Ejbtut/Props.java [8:1] package javax.ejb does not exist
import javax.ejb.*;
^
Ejbtut/Props.java [11:1] package javax.ejb does not exist
public interface Props extends javax.ejb.EJBObject {
^
Ejbtut/PropsHome.java [8:1] package javax.ejb does not exist
import javax.ejb.*;
^
Ejbtut/PropsHome.java [12:1] package javax.ejb does not exist
public interface PropsHome extends javax.ejb.EJBHome {
^
Ejbtut/PropsHome.java [16:1] package javax.ejb does not exist
) throws javax.ejb.CreateException,
^
Ejbtut/PropsHome.java [18:1] package javax.ejb does not exist
Props findByPrimaryKey( java.lang.String pkey ) throws javax.ejb.FinderException,
^
12 errors
Errors compiling Ejbtut.
ASKER
Hi sompol_kiatkamolchai,
Here is what I got in the test dir using javac -d. I didn't get errors, but I don't have *.class, either .... :-(
(but I got those using javac *.java)
-------------------------- ---------- ---------- ---------- ----
C:\Documents and Settings\meow\props>javac -d Props.java
C:\Documents and Settings\meow\props>javac -d PropsBean.java
C:\Documents and Settings\meow\props>javac -d PropsHome.java
C:\Documents and Settings\meow\props>dir
Volume in drive C has no label.
Volume Serial Number is 0000-042C
Directory of C:\Documents and Settings\meow\props
2004/09/06 上午 12:31 <DIR> .
2004/09/06 上午 12:31 <DIR> ..
2004/09/05 上午 01:25 531 Props.java
2004/09/05 上午 01:25 2,552 PropsBean.java
2004/09/05 上午 01:25 542 PropsHome.java
3 File(s) 3,625 bytes
2 Dir(s) 16,669,421,568 bytes free
C:\Documents and Settings\meow\props>javac *.java
C:\Documents and Settings\meow\props>dir
Volume in drive C has no label.
Volume Serial Number is 0000-042C
Directory of C:\Documents and Settings\meow\props
2004/09/06 上午 12:46 <DIR> .
2004/09/06 上午 12:46 <DIR> ..
2004/09/06 上午 12:46 299 Props.class
2004/09/05 上午 01:25 531 Props.java
2004/09/06 上午 12:46 1,474 PropsBean.class
2004/09/05 上午 01:25 2,552 PropsBean.java
2004/09/06 上午 12:46 393 PropsHome.class
2004/09/05 上午 01:25 542 PropsHome.java
6 File(s) 5,791 bytes
2 Dir(s) 16,669,417,472 bytes free
Here is what I got in the test dir using javac -d. I didn't get errors, but I don't have *.class, either .... :-(
(but I got those using javac *.java)
--------------------------
C:\Documents and Settings\meow\props>javac -d Props.java
C:\Documents and Settings\meow\props>javac -d PropsBean.java
C:\Documents and Settings\meow\props>javac -d PropsHome.java
C:\Documents and Settings\meow\props>dir
Volume in drive C has no label.
Volume Serial Number is 0000-042C
Directory of C:\Documents and Settings\meow\props
2004/09/06 上午 12:31 <DIR> .
2004/09/06 上午 12:31 <DIR> ..
2004/09/05 上午 01:25 531 Props.java
2004/09/05 上午 01:25 2,552 PropsBean.java
2004/09/05 上午 01:25 542 PropsHome.java
3 File(s) 3,625 bytes
2 Dir(s) 16,669,421,568 bytes free
C:\Documents and Settings\meow\props>javac *.java
C:\Documents and Settings\meow\props>dir
Volume in drive C has no label.
Volume Serial Number is 0000-042C
Directory of C:\Documents and Settings\meow\props
2004/09/06 上午 12:46 <DIR> .
2004/09/06 上午 12:46 <DIR> ..
2004/09/06 上午 12:46 299 Props.class
2004/09/05 上午 01:25 531 Props.java
2004/09/06 上午 12:46 1,474 PropsBean.class
2004/09/05 上午 01:25 2,552 PropsBean.java
2004/09/06 上午 12:46 393 PropsHome.class
2004/09/05 上午 01:25 542 PropsHome.java
6 File(s) 5,791 bytes
2 Dir(s) 16,669,417,472 bytes free
Ummm. I think you have to set classpath in .netbean. Try to find it in menu. Sorry that I can not help you much about .netbean since I don't have experience with it.
Looks like netbeans is not finding j2ee.jar, you may need to specify its location seperately for the ide.
Does it work from the command line using javac?
Does it work from the command line using javac?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
> Here is what I got in the test dir using javac -d. I didn't get errors, but I don't have *.class, either .... :-(
Thats because the -d option says to put them elsewhere.
Remove it and it'll put them in same directory.
Thats because the -d option says to put them elsewhere.
Remove it and it'll put them in same directory.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
hi sompol_kiakamolchai,
It works with javac -d . Props.java. Thanks !
Hi objects,
I have got the jar file mounted in the .netbean ... Thanks ...
Thanks all ! I am going to take a further look of beans ....
It works with javac -d . Props.java. Thanks !
Hi objects,
I have got the jar file mounted in the .netbean ... Thanks ...
Thanks all ! I am going to take a further look of beans ....