0

A similar question exists but the best answer seems to state there is no pure solution, but rather one needs to call the operating system.

Why am i after such utilities, primarily so i can integrate them into the groovy shell.

4
  • "A similar question exists" Link to the question. Commented Jul 5, 2011 at 7:55
  • 1
    @mP, you have almost 100 questions without an accepted answer! That must be a some sort of record. ;) Commented Jul 5, 2011 at 7:57
  • perfect opportunity to write such a library, if it really doesn't exist... ;-) Commented Jul 5, 2011 at 8:21
  • @mP so if you'll decide to write it, let us know when it'll be done... :-) Commented Jul 6, 2011 at 12:00

3 Answers 3

4

Some (mostly text-processing related) unix commands are implemented here: http://www.unix4j.org

Sign up to request clarification or add additional context in comments.

Comments

0

I am unaware of a pre-cooked, drop in jar, and this same question on superuser indicates there isnt one. However, libraries such as:

Should make life easier to implement them.

This question also mentions a solution for ls

3 Comments

How does guava compare unix file utilities like ls (list) i dont see the similarities at all... ls takes parameters and prints a listing...sure it can be done with guava or even plain java but your answers are no way near or complete solutions as a replacement for the unix utils done in pure java.
@mP: as I said in the answer, I am unaware of a java replacement for the unix utils and I very much doubt there is one. See also the superuser question I linked to. The libraries listed provide some additional abstractions above standard Java so they will make life a little easier for implementing things like ls, cat, etc. However they are not a drop in replacement. You will have to roll your own as far as Im aware.
@DG yes guava no - this is not a problem that is about ioc or di, commons-io yes its a start if one was to write your own. The super -user q doesnt really say much.
-1

Most of this functionality is available in Java, it just has different names.

If you want to call these applications you can use Runtime.exec();

13 Comments

Thats not a pure java solution.
The reason i have so many unaswered questions i because i dont get answers. Read my q and browse the answers and see how poor they are.
I mean if im on windows, i probably dont have "ls" so your answer is not really a proper solution nor is it portable.
Java has a way of doing what you want already. You say you want a pure Java solution, but you want to use Unix like commands to do it. Can you see why we are confused as to what you want? It appears what you want it program in Java using only your knowledge of shells commands??
Mate with answers like this, one can say just program it, java is turing complete its just a matter of writing whatever from scratch. Thats not a real answer It may be the only answer but in te spirit of leveeraging the work of others (which is what my q states) this in no way helps.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.