|
|
|
|||||
|
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. |
|
|||||
|
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! |
|
|||||
|
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! |
|
||||||
|
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. |
|
|||||
|
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. |
|
||||||
|
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 |
|
|||||
|
The problem is not solved, I sent the source files to you, please have a look and give me more advice, thanks.
__________________
a cup of Java, cheers! |
|
|||||
|
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! |
|
||||||
|
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 |
|
|||||
|
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! |
|
|||||
|
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. |
|
|||||
|
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! |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|