Coder Social home page Coder Social logo

jar-test's Introduction

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 /../.

jar-test's People

Contributors

dependabot[bot] avatar drbobbeaty avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.