Skip to content

drbobbeaty/jar-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JRuby 1.7.0 and Warble Minimal Test

Introduction

I wanted to make a simple test case for the JRuby guys to work with when looking at a problem we've had in processing the Dir.glob() method and using relative directories. This is that test case.

Building

Simply bundle everything up:

$ bundle install

and you're ready to run it as a script.

If you want to package it up as a jar, then simply:

$ warble

and the jar will be created.

Running as a Script

This should work regardless of the JDK or platform as it's just using stock JRuby 1.7.0:

$ bin/myapp
Howdy!
got: bin/../config
config files: ["bin/../config/admin"]
contents: Line 1
Line 2
Line 3
====================================
uniform way: .
config files: ["./config/admin"]
contents: Line 1
Line 2
Line 3

all looks good.

Running as an Executable Jar

This is where it gets dodgey:

$ java -jar jar-test.jar
Howdy!
got: file:/Users/bob/jar-test/jar-test.jar!/jar-test/bin/../config
config files: []
contents: 
====================================
uniform way: file:/Users/bob/jar-test/jar-test.jar!/jar-test
config files: ["file:/Users/bob/jar-test/jar-test.jar!/jar-test/config/admin"]
contents: Line 1
Line 2
Line 3

At this point the problem presents itself. It's not the JDK, it's the relative file path manipulation in the jar and it's use in the Dir.glob() method. It's not properly moving up a node in the directory tree - in this case, in the jar, when it hits the /../.

About

JRuby 1.7.0 executable jar test with Dir.glob() issue

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages