GeneralThis forum is for non-technical general discussion which can include both Linux and non-Linux topics. Have fun!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi, in windows i use start in a bat file to start the java vm eg:
start java Prog1.class
Now i want to have a command just like that in linux! By using this command i always get the java terminal window! Even if the appl is launched through another java appl! Any Idea?
1. You typically run a Java program with syntax like:
java MyClass
2. The syntax is the same whether it's a Windows .bat file or a Linux shell script. It runs the program, whether the Java program uses the java.System command line or a Swing GUI.
3. Unfortunately, if you're on Windows, this syntax *requires* a DOS command prompt, whether you want one or not.
4. But if you're on Windows, you can use "javaw.exe" instead of the command-line "java" to start your JVM. In this case, you do *not* need a command prompt:
thanks but thats not it. If you have windows you may try it. When you put start instead of putting java directly, you will see that the name of the terminal will be called java in the taskbar. in fact another terminal is open for the operation and first command prompt is continued! Try it, you will understand it better!
C:\Documents and Settings\kaveeta>start /?
Starts a separate window to run a specified program or command.
START ["title"] [/Dpath] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED]
[/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL | /BELOWNORMAL]
[/WAIT] [/B] [command/program]
[parameters]
"title" Title to display in window title bar.
path Starting directory
B Start application without creating a new window. The
application has ^C handling ignored. Unless the application
enables ^C processing, ^Break is the only way to interrupt
the application
I The new environment will be the original environment passed
to the cmd.exe and not the current environment.
MIN Start window minimized
MAX Start window maximized
SEPARATE Start 16-bit Windows program in separate memory space
SHARED Start 16-bit Windows program in shared memory space
LOW Start application in the IDLE priority class
NORMAL Start application in the NORMAL priority class
HIGH Start application in the HIGH priority class
REALTIME Start application in the REALTIME priority class
ABOVENORMAL Start application in the ABOVENORMAL priority class
BELOWNORMAL Start application in the BELOWNORMAL priority class
WAIT Start application and wait for it to terminate
command/program
If it is an internal cmd command or a batch file then
the command processor is run with the /K switch to cmd.exe.
This means that the window will remain after the command
has been run.
If it is not an internal cmd command or batch file then
it is a program and will run as either a windowed application
or a console application.
parameters These are the parameters passed to the command/program
If Command Extensions are enabled, external command invocation
through the command line or the START command changes as follows:
non-executable files may be invoked through their file association just
by typing the name of the file as a command. (e.g. WORD.DOC would
launch the application associated with the .DOC file extension).
See the ASSOC and FTYPE commands for how to create these
associations from within a command script.
When executing an application that is a 32-bit GUI application, CMD.EXE
does not wait for the application to terminate before returning to
the command prompt. This new behavior does NOT occur if executing
within a command script.
When executing a command line whose first token is the string "CMD "
without an extension or path qualifier, then "CMD" is replaced with
the value of the COMSPEC variable. This prevents picking up CMD.EXE
from the current directory.
When executing a command line whose first token does NOT contain an
extension, then CMD.EXE uses the value of the PATHEXT
environment variable to determine which extensions to look for
and in what order. The default value for the PATHEXT variable
is:
.COM;.EXE;.BAT;.CMD
Notice the syntax is the same as the PATH variable, with
semicolons separating the different elements.
When searching for an executable, if there is no match on any extension,
then looks to see if the name matches a directory name. If it does, the
START command launches the Explorer on that path. If done from the
command line, it is the equivalent to doing a CD /D to that path.
Thats the default behaviour! Now i use start only when debugging my appls. The reason is that I have a java appl that launches a totally diferrent appls through a bat file and then exits. When the first appl launches the second appl, i don't get any terminal for the 2nd appl unless i use start. This is the same for linux except that i don't know the eqivalent of start in linux!
My I-don't-use-windows-at-all-or-java-for-that-matter guess is something like:
xterm /opt/java/bin/java ...
You'd open a terminal that way to launch the program. If you are talking more along the lines of launching java in a seperate window anytime you go to a website that serves up a java applet, my guess would be that you could create a small script:
Find the browser plugin for java, probably somewhere like:
/opt/java/nsplugin/java
And move it:
mv /opt/java/nsplugin/java /opt/java/nsplugin/java-real
And then, create a new file called java in that same directory, and have the contents of that file be something along the lines of:
xterm /opt/java/nsplugin/java-real
And give that a try.
I have no way of 'firing up windows' to give it whirl, so that's my best guess. You can probably hold out for someone more experienced with Java to give you a better answer.
You usually *don't* want an extra window popping up. And with the Windows "java" command, you get one, whether you want it or not. With or without the Windows "start" command. Unless you use "javaw".
In Windows or Linux, you usually just want to either a) use the existing command line, or b) create your own new (e.g. Swing) GUI frame. In neither case do you go and open a new command window.
Anyway, glad you found out about "xterm -e" (for whenever you need it), and glad you're squared away with your question!
No, thats the catch! i don't get the java command line when i launch another java appl through a java appl! Thats why i used start and now xterm -e for linux. In fact i use this command just for debuging purposes where an error has eluded me! At runtime you get all the possible errors that you won't get during compilation and thats the advantage of having the other window! I use javaw only when installing the appl to work live!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.