Arun_Jain504
asked on
Java Virtual Machine
In java How can you execute a class file using
window's "java.exe" and not sun's java VM.
window's "java.exe" and not sun's java VM.
Also, extended examples
To run a HelloWorld.class app, in the default package in a jar in C:\MyDir, use
java.exe -jar HelloWorld.jar HelloWorld
To run a HelloWorld.class app in C:\com\mindprod\mypackage, in package com.mindprod.mypackage, use
java.exe -classpath . com.mindprod.mypackage.Hel loWorld
This will not work to run a HelloWorld.class app in C:\com\mindprod\mypackage, in package com.mindprod.mypackage:
C:\com\mindprod\mypackage
java.exe -classpath . com.mindprod.mypackage.Hel loWorld
For that to work, you must use smartj instead of java.exe.
To run a HelloWorld.class app in C:\com\mindprod\mypackage, in a jar in package com.mindprod.mypackage, use
CD \AnyDir
java.exe -jar HelloWorld.jar com.mindprod.mypackage.Hel loWorld
If for any reason the examples shown do not work with your version of java.exe, try various combinations of
com.mindprod.mypackage.Hel loWorld, com/mindprod/mypackage/Hel loWorld and com\mindprod\mypackage\Hel loWorld.
Cheers,
Leo
To run a HelloWorld.class app, in the default package in a jar in C:\MyDir, use
java.exe -jar HelloWorld.jar HelloWorld
To run a HelloWorld.class app in C:\com\mindprod\mypackage,
java.exe -classpath . com.mindprod.mypackage.Hel
This will not work to run a HelloWorld.class app in C:\com\mindprod\mypackage,
C:\com\mindprod\mypackage
java.exe -classpath . com.mindprod.mypackage.Hel
For that to work, you must use smartj instead of java.exe.
To run a HelloWorld.class app in C:\com\mindprod\mypackage,
CD \AnyDir
java.exe -jar HelloWorld.jar com.mindprod.mypackage.Hel
If for any reason the examples shown do not work with your version of java.exe, try various combinations of
com.mindprod.mypackage.Hel
Cheers,
Leo
You need to either explicitly specify the path of the java.exe that you wish to use, or alter the system's PATH variable..
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Leo