__FILE__ is not expanded when it is used from within a a compiled ruby script 
used as the main class of an executable jar
-------------------------------------------------------------------------------------------------------------------------

                 Key: JRUBY-4825
                 URL: http://jira.codehaus.org/browse/JRUBY-4825
             Project: JRuby
          Issue Type: Bug
    Affects Versions: JRuby 1.5
         Environment: Windows XP, Java 1.6, JRuby 1.5 (Encountered on multiple 
other configurations)
            Reporter: Benjamin Christenson
            Assignee: Thomas E Enebo
            Priority: Minor
         Attachments: fubar.jar

Below is a screen dump of the Windows command line script I used to build and 
test the attached jar file.

Notice that when executing the compiled main script directly, __FILE__ returns 
the string 'main.rb' rather than 'file:/C:/jruby_test/fubar.jar!/main.class'.  
Other cases, such as requiring the same compiled script rather than executing 
it directly, produce the expected result.


C:\jruby_test> jruby -v
jruby 1.5.0 (ruby 1.8.7 patchlevel 249) (2010-05-12 6769999) (Java HotSpot(TM) C
lient VM 1.6.0_17) [x86-java]

C:\jruby_test>echo puts __FILE__ > main.rb

C:\jruby_test>echo puts __FILE__ > rubymain.rb

C:\jruby_test>echo require 'main' > loader.rb

C:\jruby_test>echo require 'main' > callmain.rb

C:\jruby_test>echo require 'rubymain' > callrubymain.rb

C:\jruby_test>echo require 'loader' > callloader.rb


C:\jruby_test>jrubyc main.rb callmain.rb callrubymain.rb callloader.rb
Compiling main.rb to class main
Compiling callmain.rb to class callmain
Compiling callrubymain.rb to class callrubymain
Compiling callloader.rb to class callloader

C:\jruby_test>jar -cf fubar.jar main.class callmain.class callrubymain.class 
callloader.class rubymain.rb loader.rb

C:\jruby_test>del *.class *.rb

C:\jruby_test>java -cp fubar.jar;jruby-complete-1.5.0.jar main
main.rb

C:\jruby_test>java -cp fubar.jar;jruby-complete-1.5.0.jar callmain
file:/C:/jruby_test/fubar.jar!/main.class

C:\jruby_test>java -cp fubar.jar;jruby-complete-1.5.0.jar callrubymain
file:/C:/jruby_test/fubar.jar!/rubymain.rb

C:\jruby_test>java -cp fubar.jar;jruby-complete-1.5.0.jar callloader
file:/C:/jruby_test/fubar.jar!/main.class

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to