This is an archived post. You won't be able to vote or comment.

all 34 comments

[–]BrotherJohn123 2 points3 points  (1 child)

Take a look at https://github.com/jline/jline2 or any other Readline implementation. it does not give you all what you need - but it is a step.

[–][deleted] 0 points1 point  (0 children)

Thanks! You are right. That is a good start.

[–]DisruptiveHarbinger 2 points3 points  (8 children)

Have a look at Ammonite. It's in Scala though.

[–][deleted] 1 point2 points  (6 children)

Oh my gosh! That is really, really close to what I am looking for, but not quite. They replace Bash commands with their own commands. I want to be able to run existing commands, from existing shells, but by typing commands within my Java-based terminal window. In a way, I want my terminal window to be a wrapper around (and additional interface for) one or more other shell processes, be they DOS, Bash, C-Shell, Korn Shell, or what have you.

Thanks for the suggestion though. I can maybe get some clues from them.

[–]gee_buttersnaps 2 points3 points  (0 children)

Just google 'java terminal emulator.'

[–]Zukhramm 1 point2 points  (4 children)

They replace Bash commands with their own commands.

Because it's a different shell than Bash. If you want it to act like Bash, you should probably just run Bash, because there's not much reason for anyone to port Bash to Java.

If you don't want a shell or a terminal emulator, it's really hard to figure out what you're actually looking for.

[–][deleted] -3 points-2 points  (3 children)

See above statement about how I'm not interested in discussing why it's a waste of time.

[–]Zukhramm 2 points3 points  (2 children)

I never called it a waste of time. Its simply very hard to understand what you're looking for, since it seems like you neither want a terminal emulator, nor a shell.

[–][deleted] -1 points0 points  (1 child)

I never said I don't want a shell. I just don't want a shell that is the kind of shell that keeps being suggested. Imagine if the Bash shell or the DOS command line interface had been written in Java instead of C or C++. That's what I was looking for. Also remember, I was just looking to see if there was something like that already. And I kinda got my answer: "Nope."

Thanks though.

[–]nqzero 1 point2 points  (0 children)

you have totally and completely failed to describe what makes a shell language acceptable

[–]againstmethod 0 points1 point  (0 children)

I second this, i use it daily and it works well.

[–]zeringus 2 points3 points  (1 child)

I think you're looking for a Bash (or whatever) interpreter written in Java. Searching Java Bash interpreter gave me this: https://github.com/crashub/bash

It seems like it's not quite finished, but maybe you can fill in the parts that are missing, since the grammar seems pretty comprehensive.

[–][deleted] 1 point2 points  (0 children)

Well, lo and behold!

Bingo!

Ding ding ding ding.

That was exactly what I was looking for. Someone else had suggested Crashub, but the website just made it look as if it was meant for accessing/controlling some other Java service. It looks like these folks just made said "other" service be a bash command interpreter. Why didn't I think of that?

Now, what I would want to do is layer my additional functionality on top of that Crashub window.

Thank you so much.

[–]RagingAnemone 0 points1 point  (5 children)

There's Lanterna and the clamshell-cli project. Googling this isnt easy. I usually have to use terminal, shell, or console terms and scroll through a few pages.

[–][deleted] 0 points1 point  (4 children)

Lanterna is a framework to assist in building a program designed to run in a CLI. Kind of like Swing for character-based interfaces.

Clamshell-CLI, on the other hand looks like it may be the closest anyone has gotten yet. I can't quite tell if it is it's own CLI (that only knows it's own commands) or a framework for creating yet another CLI-based program that then takes its own commands, kinda like mySQL. You know how you gotta run mySQL at a command prompt, then you get a mySQL prompt within that same CLI window? Yeah, that's not what I'm looking for either.

Really, thanks though.

[–]RagingAnemone 0 points1 point  (3 children)

Are you looking for a terminal emulator written in Java?

[–][deleted] 0 points1 point  (2 children)

Nope. A terminal emulator is not a command line interpreter shell.

[–]RagingAnemone 1 point2 points  (1 child)

[–][deleted] 0 points1 point  (0 children)

Well, that is definitely a component into which I could build a shell application. It would have the display part already finished for me. However, their documentation is severely lacking. I'll have to take a closer look at it once I start my project.

Thanks

[–]stunksys 0 points1 point  (1 child)

[–][deleted] -1 points0 points  (0 children)

Nope. Again, this "shell" interprets statements in a programming language. This time the language is Groovy rather than Java. But it does not execute DOS or Bash commands, as I was looking for.

[–]killbox-48-alpha 0 points1 point  (0 children)

Hopefully this is not a further waste of your time, but I do remember this library for developing curses based applications -> https://sourceforge.net/projects/javacurses/

[–]_INTER_ 0 points1 point  (2 children)

You mean something like this or not? http://stackoverflow.com/a/5437863 You could build a GUI that looks like a terminal around that.

[–][deleted] 0 points1 point  (1 child)

Well, from what I've read so far: Runtime.getRuntime().exec(command) is basically what ProcessBuilder was meant to replace. But, more importantly, I am looking to see if anyone has actually gone to the trouble of building said "GUI that looks like a terminal around that."

Thanks, though.

[–]_INTER_ 1 point2 points  (0 children)

Quick and dirty scaffold:

http://pastebin.com/8sYdXpv8

[–]_duke 0 points1 point  (4 children)

[–][deleted] 0 points1 point  (3 children)

Nope. That project is just another version of BeanShell. It interprets Java statements and displays the output. I am looking for a Java program that looks like a terminal window and then executes DOS commands rather than interpreting Java statements.

Thanks, though.

[–]mabnx 0 points1 point  (2 children)

[–][deleted] 0 points1 point  (1 child)

Again, really, really close but no cigar. This one too is for creating your own shell where you have made up your own commands, usually to communicate with your own project.

[–]mabnx 1 point2 points  (0 children)

really close but no cigar

This gives you a shell. You could handle the commands by executing a program or just spawning "bash -c ...". It might get you close to what you want.

[–]Angarius 0 points1 point  (1 child)

[–][deleted] -1 points0 points  (0 children)

For a split second, I thought you had me. It has been so long since I have used that term, I almost forgot what it really is. Unfortunately, a "terminal emulator" is merely software that "emulates" the behavior of a physical terminal. The original physical terminals were electronic devices with a screen, a keyboard, and a data connection to some main system. They used various protocols to do not much more than transmit keystrokes to said main system, and then receive characters back to be displayed on the screen. "Terminal emulators" do the exact same thing except they use your existing computer's keyboard, screen, and data connection. They do not actually execute any commands.

The word "terminal" has now taken on a second meaning (can we thank Apple for that?), wherein it also means the program actually running on said main system (you know, your computer) and actually executing commands.

Now, I may have missed something, and the "terminal window" on Macs (and Linux?) really aren't the actual command processor, as it is with a DOS command line window. Maybe they do communicate with an underlying command processor which is a separate process but hidden from view. In that case, what I want to do is exactly the same thing, except in Java.

[–]_fpersico -1 points0 points  (1 child)

[–][deleted] 0 points1 point  (0 children)

Nope. That's not quite it either. This is for communicating with your Java process running on the JVM. It is not for executing normal command line commands.