Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (406)
games submitted by our members
Games in WIP (292)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Java on Shell  (Read 936 times)
0 Members and 1 Guest are viewing this topic.
Online ReBirth
« Posted 2013-03-11 05:51:30 »

Is there a way to make a java class to act like shell command? Like
1  
> ClassName [parameter] [values]

Similar to "apt-get install whatever". In current state, we have to include "java" command everytime we call it.

Or it's impossible so I need to learn bash? persecutioncomplex

Offline Agro
« Reply #1 - Posted 2013-03-11 06:02:28 »

I think you can run a class file from shell. Think I've done it before, can't remember how.

Offline ra4king

JGO Kernel


Medals: 264
Projects: 2


I'm the King!


« Reply #2 - Posted 2013-03-11 06:08:37 »

Alias.

1  
alias ClassName="java ClassName"

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Online ReBirth
« Reply #3 - Posted 2013-03-11 12:57:36 »

Ok I'll try it.

Another thing,
1) how to get the java program listed in repository?
2) how to make the program take over the terminal screen, like when we use nano or other text editors?
3) Can java program has auto-completion too? (tab key)

Offline ra4king

JGO Kernel


Medals: 264
Projects: 2


I'm the King!


« Reply #4 - Posted 2013-03-11 13:09:23 »

1. Not sure but I'm pretty sure it's not as simple as submitting a jar since there are strict requirements on the packaging and executing structure.

2. You can't.

3. Not possible with any console application AFAIK.

Offline cylab

JGO Knight


Medals: 30



« Reply #5 - Posted 2013-03-11 13:44:19 »

Take a look at beanshell: http://www.beanshell.org/home.html

But java is not the best shell language, so learning bash might turn out the better decision...

Mathias - I Know What [you] Did Last Summer!
Online ReBirth
« Reply #6 - Posted 2013-03-11 15:42:49 »

I have looked on beanshell, what exactly is it? I read the intro, quick start, but get no point of its purpose.

Offline nsigma

JGO Knight


Medals: 37



« Reply #7 - Posted 2013-03-11 16:14:15 »

2) how to make the program take over the terminal screen, like when we use nano or other text editors?

2. You can't.

Can't?  Wink  Try googling Java terminal curses

This looks like it could be interesting - http://code.google.com/p/lanterna/ - and without native libs too.

There's also JCurses, though that requires natives.


Offline kevglass
« League of Dukes »

JGO Kernel


Medals: 54
Projects: 20


Mentally unstable, best avoided.


« Reply #8 - Posted 2013-03-11 16:23:34 »

Ooooh, lanterna looks good!

Kev

Offline sproingie
« Reply #9 - Posted 2013-03-11 16:24:03 »

You might want to run java as
java -noverify
for commandline apps that you want to start up quicker.  You can also look into nailgun for even faster startup though there's some security caveats that apply to that.
Games published by our own members! Check 'em out!
Play the free demo of Revenge of the Titans!
Offline ra4king

JGO Kernel


Medals: 264
Projects: 2


I'm the King!


« Reply #10 - Posted 2013-03-11 20:51:15 »

2) how to make the program take over the terminal screen, like when we use nano or other text editors?

2. You can't.

Can't?  Wink  Try googling Java terminal curses

This looks like it could be interesting - http://code.google.com/p/lanterna/ - and without native libs too.

There's also JCurses, though that requires natives.
Huh so with Lantern, to enter private mode, it write a bunch of weird characters out and executes an external process. O_o

Offline cylab

JGO Knight


Medals: 30



« Reply #11 - Posted 2013-03-12 11:39:19 »

I have looked on beanshell, what exactly is it? I read the intro, quick start, but get no point of its purpose.
well its a shell to script beans - hence java classes. you can run it interactively from the commandline, so youmight get a better environment for interacting with your classes. there is also groovyshell http://groovy.codehaus.org/Groovy+Shell#GroovyShell-Features which might offer more features.

OT: man - I hate posting here from my 2.3 android phone. does it work better with 4.1?

Mathias - I Know What [you] Did Last Summer!
Offline nsigma

JGO Knight


Medals: 37



« Reply #12 - Posted 2013-03-12 11:58:36 »

Huh so with Lantern, to enter private mode, it write a bunch of weird characters out and executes an external process. O_o

Isn't that kind of how this whole thing works?  Wink http://en.wikipedia.org/wiki/ANSI_escape_code

OT: man - I hate posting here from my 2.3 android phone. does it work better with 4.1?

An almost immeasurably tiny amount.  Grin

Online ReBirth
« Reply #13 - Posted 2013-03-12 13:22:07 »

@nsigma
That looks great! Unfortunately there's no example code yet, but I hope it can get along with shell.

@cylab
So that's it. It seems provide easy way to invoke GUI. However lanterna maybe more suitable for me.

Pages: [1]
  ignore  |  Print  
 
 

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Browse for soundtracks for your game!

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (66 views)
2013-05-17 21:29:12

alaslipknot (75 views)
2013-05-16 21:24:48

gouessej (106 views)
2013-05-16 00:53:38

gouessej (103 views)
2013-05-16 00:17:58

theagentd (114 views)
2013-05-15 15:01:13

theagentd (103 views)
2013-05-15 15:00:54

StreetDoggy (148 views)
2013-05-14 15:56:26

kutucuk (171 views)
2013-05-12 17:10:36

kutucuk (169 views)
2013-05-12 15:36:09

UnluckyDevil (178 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!
Page created in 0.105 seconds with 21 queries.