Post by mmbell10Post by Eric SosmanPost by mmbell10My java.exe not run in the command promt!
Neither does mine -- not until I type "java" plus additional
command-line arguments and then press Enter. Try doing that,
and then tell us
EXACTLY what you typed
EXACTLY what happened next
EXACTLY what messages appeared (ALL of them)
"Not run" all by itself isn't enough information to support
a diagnosis.
I just opened the command promt and typed in java and hit enter. it came up with a list of stuff the im going to assume is the java program. then i typed java.exe and it did the same thing. but then when i tried clicking on the actual java.exe in my program files, the cmd promt opened really quicly and then shut down. what commands should i type? im fairly new at this stuff.. sorry.
My main problem is that when i try to make my batch file for my modded minecraft server, it just opens the cmd promt and the closes it quickly. Still not sure what to do? Thanks for the response though!
The "java" command launches the Java Virtual Machine, but
you must also tell the JVM what you want it to do: What class
should it load and execute? The JVM cannot read your mind to
learn which of the thousands (literally!) of class files on
your machine is the one you happen to be interested in! This
information (and other stuff, mostly optional) comes from the
command-line arguments, for example
java com.mmbell.minemod.MainClass
... to load the MainClass class of the com.mmbell.minemod
package and call its `public static void main(String[])' method.
Even this won't work if the JVM can't find the right package
directories or can't find the MainClass.class file. See
<http://en.wikipedia.org/wiki/Classpath_%28Java%29>
... for a brief explanation. (Recommendation: Don't use
the CLASSPATH environment variable; it's more trouble than
it's worth.)
There's also a mechanism for loading classes from an archive
called a "jar file;" from the very little you've disclosed I
can't tell whether you need this or not.
Just typing "java" starts the JVM, but when it sees you
haven't told it what to do it displays a help message and quits.
When you click on the executable file in Windows, a command
window opens, the JVM starts, the JVM writes its help message
and exits, and then Windows says "Aha: *That's* finished, now
I can erase the command window nobody's using any more" so you
don't even see the help message unless your vision is uncommonly
good. When you run unadorned "java" from your batch file, once
again the JVM starts, sees it has nothing to do, writes its
help message (somewhere), and exits.
--
Eric Sosman
***@comcast-dot-net.invalid