Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 10-18-2004
jschina jschina is offline
Registered User
 
Name: Sha Jiang
Organization: CE
Project: None
 
Join Date: Oct 2004
Location: Beijing, China
Posts: 14
Send a message via MSN to jschina
-->
Smile Beginner

I am a university student in China, I am very interested in ICE. But I am beginner, now I have some trouble with it.
I have installed Ice in C:\Ice-1.5.1, my operation System is WindowXp. I want to use ICE with Java, the JDK is J2sdk1.5.0.
I have set the environment variables as follows,
ICEJ_HOME C:\Ice-1.5.1
CLASSPATH .;%ICEJ_HOME%\lib\Ice.jar
Path %ICEJ_HOME%\bin

The files: Printer.ice, PrinterI.java, Server.java, Client.java are all in the directory Demo, all files are written as the same as ICE manual shows. Then I run commands, the result as follows,

G:\Demo>mkdir G

G:\Demo>slice2java --output-dir G Printer.ice

G:\Demo>javac -d classes -classpath classes:$ICEJ_HOME/lib/Ice.jar\-source 1.4 Server.java PrinterI.java G/*.java
javac: invalid flag: 1.4
Usage: javac <options> <source files>
where possible options include:
-g Generate all debugging info
-g:none Generate no debugging info
-g:{lines,vars,source} Generate only some debugging info
-nowarn Generate no warnings
-verbose Output messages about what the compiler is doing
-deprecation Output source locations where deprecated APIs are used
-classpath <path> Specify where to find user class files
-cp <path> Specify where to find user class files
-sourcepath <path> Specify where to find input source files
-bootclasspath <path> Override location of bootstrap class files
-extdirs <dirs> Override location of installed extensions
-endorseddirs <dirs> Override location of endorsed standards path
-d <directory> Specify where to place generated class files
-encoding <encoding> Specify character encoding used by source files
-source <release> Provide source compatibility with specified release

-target <release> Generate class files for specific VM version
-version Version information
-help Print a synopsis of standard options
-X Print a synopsis of nonstandard options
-J<flag> Pass <flag> directly to the runtime system

What's wrong with it? I always think the environment variables are wrong, is it? Should I need the source IceJ-1.5.1.
Thanks very much!
__________________
a cup of Java, cheers!

Last edited by jschina : 10-18-2004 at 05:55 AM.
Reply With Quote
  #2 (permalink)  
Old 10-18-2004
marc's Avatar
marc marc is offline
ZeroC Staff
 
Name: Marc Laukien
Organization: ZeroC, Inc.
Project: The Internet Communications Engine
 
Join Date: Feb 2003
Location: Florida
Posts: 1,781
Remove the backslash from this line:

javac -d classes -classpath classes:$ICEJ_HOME/lib/Ice.jar\-source 1.4 Server.java

It should be:

javac -d classes -classpath classes:$ICEJ_HOME/lib/Ice.jar -source 1.4 Server.java
Reply With Quote
  #3 (permalink)  
Old 10-18-2004
jschina jschina is offline
Registered User
 
Name: Sha Jiang
Organization: CE
Project: None
 
Join Date: Oct 2004
Location: Beijing, China
Posts: 14
Send a message via MSN to jschina
-->
Thanks for your reply! I will follow your instruction, and try again.
__________________
a cup of Java, cheers!
Reply With Quote
  #4 (permalink)  
Old 10-19-2004
jschina jschina is offline
Registered User
 
Name: Sha Jiang
Organization: CE
Project: None
 
Join Date: Oct 2004
Location: Beijing, China
Posts: 14
Send a message via MSN to jschina
-->
Question

It's error again. The information as follows,

G:\Demo>javac -d classes -classpath classes:$ICEJ_HOME/lib/Ice.jar -source 1.4 Server.java
Server.java:4: package Ice does not exist
Ice.Communicator ic = null;
^
Server.java:7: package Ice does not exist
ic = Ice.Util.initialize( args );
^
Server.java:8: package Ice does not exist
Ice.ObjectAdapter adapter
^
Server.java:11: package Ice does not exist
Ice.Object object = new PrinterI();
^
Server.java:11: cannot find symbol
symbol : class PrinterI
location: class Server
Ice.Object object = new PrinterI();
^
Server.java:12: cannot find symbol
symbol : variable Object
location: class Server
adapter.add( Object,
^
Server.java:13: package Ice does not exist
Ice.Util.stringToIdentity( "SimplePrinter" ) );
^
Server.java:17: package Ice does not exist
catch( Ice.LocalException e ) {
^
8 errors

I think it is wrong with environment variables, but I don't know how to correct it .
__________________
a cup of Java, cheers!
Reply With Quote
  #5 (permalink)  
Old 10-19-2004
jschina jschina is offline
Registered User
 
Name: Sha Jiang
Organization: CE
Project: None
 
Join Date: Oct 2004
Location: Beijing, China
Posts: 14
Send a message via MSN to jschina
-->
Post

The source of Server.java is

public class Server {
public static void main( String[] args ) {
int status = 0;
Ice.Communicator ic = null;

try {
ic = Ice.Util.initialize( args );
Ice.ObjectAdapter adapter = ic.createObjectAdapterWithEndpoints( "SimplePrinterAdapter", "default -p 10000" );
Ice.Object object = new PrinterI();
adapter.add( Object, Ice.Util.stringToIdentity( "SimplePrinter" ) );
adapter.activate();
ic.waitForShutDown();
}
catch( Ice.LocalException e ) {
e.printStackTrace();
status = 1;
}
catch( Exception e ) {
System.err.println( e.getMessage() );
status = 1;
}
finally {
if( ic != null )
ic.destroy();
}

System.exit( status );
}
}

I copy the code from Ice1.3.0 manual, Chinese edition. Is it right?
__________________
a cup of Java, cheers!
Reply With Quote
  #6 (permalink)  
Old 10-19-2004
marc's Avatar
marc marc is offline
ZeroC Staff
 
Name: Marc Laukien
Organization: ZeroC, Inc.
Project: The Internet Communications Engine
 
Join Date: Feb 2003
Location: Florida
Posts: 1,781
It appears you are using Windows and cmd.exe, correct? In this case, you cannot use $ICEJ_HOME, but must use %ICEJ_HOME% instead. You must also use ';' as classpath delimiter, not ':'. So the command should be:

javac -d classes -classpath classes;%ICEJ_HOME%/lib/Ice.jar -source 1.4 Server.java

For more information, please consult your javac documentation.
Reply With Quote
  #7 (permalink)  
Old 10-20-2004
jschina jschina is offline
Registered User
 
Name: Sha Jiang
Organization: CE
Project: None
 
Join Date: Oct 2004
Location: Beijing, China
Posts: 14
Send a message via MSN to jschina
-->
I am sorry to trouble you severally, but I don't solve the problem. I used your command line, but compilation fails again. The information is as follows,

G:\Demo>javac -d classes -classpath classes;%ICEJ_HOME%/lib/Ice.jar -source 1.4 Server.java
Server.java:11: cannot find symbol
symbol : class PrinterI
location: class Server
Ice.Object object = new PrinterI();
^
Server.java:12: cannot find symbol
symbol : variable Object
location: class Server
adapter.add( Object,
^
Server.java:15: cannot find symbol
symbol : method waitForShutDown()
location: interface Ice.Communicator
ic.waitForShutDown();
^
3 errors

The numbers of error are decreased.
I am using Windows XP, and have set the environment variables as follows,

ICEJ_HOME C:\Ice-1.5.1
CLASSPATH .;%ICEJ_HOME%\lib
Path %ICEJ_HOME%\bin

I am so puzzled, please help me.
__________________
a cup of Java, cheers!

Last edited by jschina : 10-20-2004 at 05:44 AM.
Reply With Quote
  #8 (permalink)  
Old 10-20-2004
mes's Avatar
mes mes is online now
ZeroC Staff
 
Name: Mark Spruiell
Organization: ZeroC, Inc.
Project: Ice Developer
 
Join Date: Feb 2003
Location: California
Posts: 971
Two of the errors above relate to capitalization issues. You need to change

adapter.add( Object, Ice.Util.stringToIdentity( "SimplePrinter" ) );

to

adapter.add( object, Ice.Util.stringToIdentity( "SimplePrinter" ) );

and

ic.waitForShutDown();

to

ic.waitForShutdown();

Regarding the missing PrinterI symbol, make sure that the source file is named PrinterI.java, and not something like printeri.java.

If you're still having trouble, please archive your source files in a ZIP file and attach it for us to look at.

Take care,
- Mark
Reply With Quote
  #9 (permalink)  
Old 10-21-2004
jschina jschina is offline
Registered User
 
Name: Sha Jiang
Organization: CE
Project: None
 
Join Date: Oct 2004
Location: Beijing, China
Posts: 14
Send a message via MSN to jschina
-->
The problem is not solved, I sent the source files to you, please have a look and give me more advice, thanks.
Attached Files
File Type: zip demo.zip (6.9 KB, 43 views)
__________________
a cup of Java, cheers!
Reply With Quote
  #10 (permalink)  
Old 10-21-2004
jschina jschina is offline
Registered User
 
Name: Sha Jiang
Organization: CE
Project: None
 
Join Date: Oct 2004
Location: Beijing, China
Posts: 14
Send a message via MSN to jschina
-->
I am still concerned with the environment variables, did I set them correctly? I am using Windows XP, and have set environment variables as follows,

ICEJ_HOME C:\Ice-1.5.1
CLASSPATH .;%ICEJ_HOME%\lib
Path %ICEJ_HOME%\bin
__________________
a cup of Java, cheers!
Reply With Quote
  #11 (permalink)  
Old 10-21-2004
bernard's Avatar
bernard bernard is online now
ZeroC Staff
 
Name: Bernard Normier
Organization: ZeroC, Inc.
Project: Ice
 
Join Date: Feb 2003
Location: Palm Beach Gardens, FL
Posts: 816
The CLASSPATH must include the jar files, not the directory with the jar files. For example when you run the demo, you could use:

set CLASSPATH=C:\Ice-1.5.1\lib\Ice.jar;C:\Ice-1.5.1\lib\db.jar;classes

"classes" is a sub-directory in each demo directory where the compiled Java code goes (as individual .class files, not .jar archive).

Cheers,
Bernard
Reply With Quote
  #12 (permalink)  
Old 10-23-2004
jschina jschina is offline
Registered User
 
Name: Sha Jiang
Organization: CE
Project: None
 
Join Date: Oct 2004
Location: Beijing, China
Posts: 14
Send a message via MSN to jschina
-->
I uninstalled Ice1.5.1, then installed Ice1.5.1 in a new directory, E:\Ice-1.5.1
My operation system is Windows XP. I have set environment variables as follows,
ICEJ_HOME E:\Ice-1.5.1
Path %ICEJ_HOME%\bin
CLASSPATH .;%ICEJ_HOME%\lib\Ice.jar

I copyed the directory "hello" from E:\Ice-1.5.1\demoj\Ice\, and pasted it into G:\
The below is result

G:\hello>mkdir G
***** at the time, a directory "G" was created in "hello" ******
G:\hello>slice2java --output-dir G Hello.ice
***** at the time, several .java files were created in "G" ******
G:\hello>javac -d classes -classpath classes;%ICEJ_HOME%/lib/Ice.jar -source 1.4 Server.java
Server.java:16: cannot find symbol
symbol : class HelloI
location: class Server
Ice.Object object = new HelloI();
^
1 error

G:\hello>
__________________
a cup of Java, cheers!
Reply With Quote
  #13 (permalink)  
Old 10-25-2004
vsonnathi vsonnathi is offline
Registered User
 
Name: Venkat Ramana
Organization: Amazon.com
Project: Prototype
 
Join Date: May 2004
Posts: 39
Hi,

Try running this command

javac -d classes -classpath classes;%ICEJ_HOME%\lib\Ice.jar -source 1.4 Server.java

Windows path separator is \ and not /.


Thanks,
--Venkat.
Reply With Quote
  #14 (permalink)  
Old 10-26-2004
jschina jschina is offline
Registered User
 
Name: Sha Jiang
Organization: CE
Project: None
 
Join Date: Oct 2004
Location: Beijing, China
Posts: 14
Send a message via MSN to jschina
-->
Hi, vsonnathi

I used the command as follows,
javac -classpath %ICEJ_HOME%/lib/Ice.jar -source 1.4 Server.java HelloI.java G/*.java

The compilation successed.
__________________
a cup of Java, cheers!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT -4. The time now is 04:14 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2008 ZeroC, Inc.