Java terminology used for starting a new process -
i starting new process in java uses runtime.exec
. copied on of code online, , classpath uses not seem work me if change name of class accessing. line of code:
process process = runtime.exec( "java -classpath c:\\projects\\workspace\\testing\\bin program");
the class trying access program.java
. there way make work computer, long have class named program
?
so should write in area can refer class program
in computer?
the class trying access program.java. there way make work computer, long have class named program?
you (or they) need compile program. (that no different c, c++ , numerous other programming languages.)
they need have java installed on machine.
they need invoke command correctly, depending on java installed, (compiled) program is, , on1.
there various things can simplify end user. example, can implement installer installs software in standard place , provides launcher or wrapper script running it.
launching java application programmatically (as per example) has couple of problems:
you need know
java
command installed (unless can rely on search path being sane).you need know application's bytecode files , dependent libraries have been installed.
these things typically dealt creating wrapper script, or putting information application specific configuration file.
why need add "java program" in creating new process ....
because way mainstream java works. java compiler (javac
) generates "bytecode" files rather conventional (platform specific) executables. need java
command run bytecode files, 'cos operating system doesn't know haw deal them itself.
1 - things need correct are: 1) pathname of java
command, 2) classpath has include class directories , jar files application requires ... correct paths, 3) classname must correctly specified. , if invoking command programmatically java, cannot assume exec
knows how split command string arguments correctly.
Comments
Post a Comment