Re: rawr fails on packages with both ruby and java files

76 views
Skip to first unread message

James Britt

unread,
Mar 18, 2013, 6:47:26 PM3/18/13
to rawr...@googlegroups.com


On Wednesday, March 13, 2013 6:37:03 PM UTC-7, Bruce Tesar wrote:
I'm having difficulty using rawr. The problem occurs under certain
circumstances, during the creation of the target jar file: the rake task
aborts. The key portions of the rawr output look like this (I include
the full output further down):


Just to be sure I understand this:

You have a project structure like this:
  Rakefile
  build_configuration.rb
  org\monkeybars\rawr\Main.java
  src\main.rb
  src\rawrtest\Jextra.java
  src\rawrtest\rextra.rb
  lib\java\jruby-complete.jar
 

I may have taken some liberties but that shouldn't matter; I have simple code in Jextra.java and rextra.rb (hence the capitalization of the java file).

I also tried this with jextra.java andrextra,rb as a empty files, too.

I've tried this on an Ubuntu box and a Windows machine:

jruby -S rake rawr:clean

jruby -S rake rawr:jar

On both platforms it works fine.  Neither, though , were the same as yours.  I was using rawr 1.6.4 and JRuby 1.7.3, but on 64-bit Windows with 64-bit Java.


I'm going to see if I can try this wth a 32-bit Java, but in the meantime is my understanding of the project set-up correct?


James Britt

James Britt

unread,
Mar 18, 2013, 7:45:48 PM3/18/13
to rawr...@googlegroups.com
I've now just tried this using a 32-bit Java on my 64-bit Win7 install, and do not get any jar-creation errors.

(I did get any error for having org/monkeybars/rawr/Main.java in the wrong place, but not when creating the jar, only  when trying to run it. I fixed that and was again able to make the jar, then I could run  the code from the jar.)


James


James Britt

unread,
Mar 19, 2013, 7:39:24 PM3/19/13
to rawr...@googlegroups.com


On Tuesday, March 19, 2013 9:32:06 AM UTC-7, Bruce Tesar wrote:
James,

to follow up: I turned to a second machine I have at home, also with Win7 64-bit. It does not have NetBeans installed, nor monkeybars, nor did it have JRuby on it until I installed it this morning (ver. 1.7.3, 32-bit). I installed rawr with the following command:
jgem install rawr --source http://gems.neurogami.com

That installed rawr-1.6.4 (as well as xml-simple-1.1.2, hoe-3.5.2, s4t-utils-1.0.4, builder-3.2.0, user-choices-1.1.6.1, and rubyzip-0.9.9).


That should be fine.

 

I then recreated the essence of my rawrtest project, all via text editor, and ran the "rawr install" command in the project. I made two changes to build_configuration.rb:
c.executable_type = "console"
c.target_jvm_version = 1.7


OK

 
I am now getting exactly the same problematic behavior as on my other machine. I have the two "dummy" files, rextra.rb and jextra.java, and I get the jar creation error. If I simply change the file types of both dummy files to .rb, the jar is created successfully. If I change the file types of both dummy files to .java, the jar is created successfully. I also get the same "invalid Unicode Property" warning that I mentioned in my previous post: this appears on both the successful and failed jar creations of rawr.


I am absolutely puzzled.   
 
Should I be getting the rawr gem from somewhere else?


No, you should have the latest code.   Just to be sure, I uninstalled my version of rawr and reinstalled from http://gems.neurogami.com and it all works for me. 

Caveat: I had to switch back to 64-bit Java because I'm preparing demos for a talk tonight and they fail if they try to use 32-bit Java.  

BTW, I never see that encoding message.  I wonder if there's some default system encoding issue.  

Maybe rawr needs a verbose mode to spew out all the details of what it's doing.


James





Bruce


On Monday, March 18, 2013 11:08:22 PM UTC-4, Bruce Tesar wrote:


On Monday, March 18, 2013 6:47:26 PM UTC-4, James Britt wrote:



Just to be sure I understand this:

You have a project structure like this:
  Rakefile
  build_configuration.rb
  org\monkeybars\rawr\Main.java
  src\main.rb
  src\rawrtest\Jextra.java
  src\rawrtest\rextra.rb
  lib\java\jruby-complete.jar
 


Almost. I have src\org\monkeybars\rawr\Main.java
I also have:
build.xml
manifest.mf

Those are the only differences.
 
jruby -S rake rawr:clean

jruby -S rake rawr:jar

I just tried it again on my setup. The rawr:clean command succeeds (it removes the package subdir). But rawr:jar still produces an "error during the creation of the jar file."
 
When both commands run, I get a *warning* about an invalid Unicode property (identical for both commands). The actual text of the warning is:

c:/Programs/jruby-1.7.3/lib/ruby/gems/shared/gems/rake-10.0.3/lib/rake/backtrace
.rb:11 warning: invalid Unicode Property \P: /(\Ac:\Programs\jruby-1.7.3|c:/Prog
rams/jruby-1.7.3/lib|c:/Programs/jruby-1.7.3/lib/ruby|c:/Programs/jruby-1.7.3/li
b/ruby/1.9|c:/Programs/jruby-1.7.3/lib/ruby/shared|c:/Programs/jruby-1.7.3/lib/r
uby/1.9/site_ruby|c:/Programs/jruby\-1\.7\.3/lib/ruby/gems/shared/gems/rake\-10\
.0\.3/lib|bin/rake:\d+)/

I haven't tried to decode this in detail, but it looks like it might be a problem with regex processing of path values. The expression looks like a list of paths, separated by '|', with the odd property that the first path in the list uses backslashes, while the rest of them are using forward slashes. The first backslash, after the drive designator c:, is for subdirectory Programs, creating a \P, which matches the "invalid Unicode Property" the warning appears to be complaining about.

I don't know if the warning is related to the error I'm getting with rawr or not, but I bring this up in part because my earlier efforts to track down the problem (in my original post) suggested that the problem involved incorrect path specifications during the construction of the jar. Could it be that our setups differ in some library involved with processing these paths? The warning is originating from a file in the rake gem, which for me is ver. 10.0.3; could the rake version possibly matter? The list of paths mentioned in the warning don't appear to have anything to do with rawr or my test project: they all refer to the jruby installation.

The only project set-up difference that looks possibly significant between us is the location of the Main.java. If you can run rawr on this project without errors, then there must be something incompatible on my end, I'm just not sure what.

I greatly appreciate your taking the time to test this out.

Bruce


James Britt

unread,
Mar 20, 2013, 7:11:27 PM3/20/13
to rawr...@googlegroups.com
Bruce Tesar wrote:
> James,
>
>
> I am now getting exactly the same problematic behavior as on my other
> machine.


If it's any consolation, and I'm sure it's not, I just tried your
rawtest.zip files and sure enough I get that error. On Ubuntu.


Now I need to go see what's going on here.

At least it's repeatable. :)



James

Bruce Tesar

unread,
Mar 20, 2013, 7:55:39 PM3/20/13
to rawr...@googlegroups.com
 

If it's any consolation, and I'm sure it's not, I just tried your
rawtest.zip files and sure enough I get that error.  On Ubuntu.

At least I'm no longer the only one. :-)
 

Now I need to go see what's going on here.

At least it's repeatable. :)

I really appreciate your looking into this. I pushed further on the "invalid Unicode" warning, as a place to start, and determined that the problem originated in the RbConfig::CONFIG["prefix"] environment property. This has nothing to do with the rawr code whatsoever; the warning occurs anytime I run rake. I put a separate post about this with the details on the JRuby forum; hopefully, someone will have some idea why this happens, and how to fix it. I don't know if this has anything to do with the jar creation error.

Regards,
Bruce

James Britt

unread,
Mar 20, 2013, 9:22:28 PM3/20/13
to rawr...@googlegroups.com
So here's what I found:

The Java file has this:

package rawrtest;


so when it gets compiled the class file goes into the path
'java/rawrtest/jextra.class'. Rawr, when adding it to the zip file,
omits that leading 'java/'; it gets added to the zip file as "rawrtest".

However, there's also the ruby file that lives in the same folder as the
java source file. Rawr turns this into "ruby/rawrtest/rextra.rb" and
when adding it to the zip file maps the folder to, of course, "rawrtest".

So when it comes time to add that Java class the folder 'rawrtest'
already exists in the zip file and it complains.

They question now is, what's the right way to handle this?

James
Reply all
Reply to author
Forward
0 new messages