1

how can i start a java program in a new terminal window ?

when i say

java myprog

it starts on the same terminal window. I want it to go onto a new terminal window. in ubuntu

2
  • 11
    Terminal windows are OS specific and have nothing to do with Java. What OS are you using, and what shell? Commented Feb 15, 2011 at 14:47
  • oh i forgot to mention that its for ubuntu Commented Feb 15, 2011 at 17:01

3 Answers 3

2

Assuming you use xterm as your terminal program

xterm -e java myprog

should do the trick. Or

gnome-terminal -e "java myprog"

with gnome-terminal.

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

4 Comments

isnt there a universal command that would work on all linux terminals ?
@user602774 The -e flag works with xterm, gnome-terminal, rxvt and Konsole. Maybe a de facto standard?
I think xterm is fairly universal, since most (if not all) Linux desktops use X11-based desktops and xterm comes with x11
That's true, also Mac and Cygwin/X versions are X11-based. Maybe xterm could be in an optional package and some installations don't have it? I know it's in Mac X11 and Ubuntu, but I'm thinking in Arch Linux or Gentoo, for example.
1

On windows:

cmd /c "java myprog"

should do what you want.

1 Comment

Yep I just noticed the comment too, sorry flagger.
0

The command to open a new terminal window depends on what desktop you use (gnome, KDE, XFCE...). For gnome (Ubuntu) the command is gnome-terminal, for KDE (Kubuntu) konsole (I think...). xterm should work also on most distributions.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.