Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

rmic stumbles over assert  RSS feed

 
Tom Kalmijn
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This must be pretty basic but I have been searching google as well as javaranch for over an hour now... so I might as well join in and actually post my first question here!

When I run rmic it spits out "Invalid expression statement" for every assert statement it finds. I am using JDK 1.4.2_05

Is there a switch to make the RMI compiler aware of assertions?

Thanks in advance (by the way javaranch is great, I browse it all the time when I am working on my SCJD assignment).
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just tested it out in 1.4.2_03 and rmic didn't complain at all over asserts. Double check your PATH and make sure no older versions of rmic are being called... (this is a pain because there's no rmic -version option, and unless you're on a *nix based machine you can't do a "which rmic" to figure out the path of the version that is being called by default.)
 
Tom Kalmijn
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the quick response Nate.

After you mentioned rmic versions I did a system wide search on my W2K box and only one version was found.

Now comes the funny part... I then went on to search for java.exe and found three of them.

1. One in my JDK directory where I expected it (which turns out to be "1.4.2_03" like yours).

2. One in a subdir of Program files (Java plug-in installation)

AND

3. One in my c:\window\system32 directory!

I browsed java.sun.com for clues how this might happen, quoting:

"In addition, if no more recent version is already installed on the machine, the (plug-in) installer puts copies of the java and javaw application-launcher executables in the Microsoft Windows system directory"

(http://java.sun.com/j2se/1.4.2/runtime_win32.html)

Horror! I was executing java.exe 1.4.2_05 while my windows PATH only included the JDK 1.4.2_03 directory.

I simply deleted the java.exe from the Windows System directory and now my RMI compiler is happy about assertions. Funny indeed, but if it works... it works.

Well thanks again Nate, you put me on track to find the solution.
 
Tom Kalmijn
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
rmic revisited.

My RMI compiler, the one that ships with JDK 1.4.2_03 is stumbling over on "assert" statements -again-.

Here is what it looks like on the command line (W2K):

>rmic package.MyRemoteInterfaceImpl
package/MyRemoteInterfaceImpl.java:56: Invalid expression statement.
assert false : e;
^

I have been toiling on this for a couple of hours again today to no avail.

What is so special about rmic & asserts? I usually just browse Google and almost always find my answer somewhere on the net. But not in this case, cant find anything about it.

It's driving me nuts.
 
Bug Menot
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you may be running rmic against the source (*.java) files.
you probably want to be running it against the (*.class) files.
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Bug Menot" -

Welcome to the JavaRanch! Please adjust your displayed name to meet the
JavaRanch Naming Policy. User names cannot be obviously fake and must constist of a first name and a last name.

You can change your user name here.

Thanks! and welcome to the JavaRanch!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!