We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

Java Virtual Machine

Medium Priority
170 Views
Last Modified: 2013-11-23
In java How can you execute a class file using
window's "java.exe" and not sun's java VM.
Comment
Watch Question

Leo EikelmanDirector, IT and Business Development

Commented:
java.exe -classpath . HelloWorld

Leo
Leo EikelmanDirector, IT and Business Development

Commented:
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.HelloWorld

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.HelloWorld
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.HelloWorld

If for any reason the examples shown do not work with your version of java.exe, try various combinations of
com.mindprod.mypackage.HelloWorld, com/mindprod/mypackage/HelloWorld and com\mindprod\mypackage\HelloWorld.

Cheers,

Leo
Top Expert 2006

Commented:
You need to either explicitly specify the path of the java.exe that you wish to use, or alter the system's PATH variable..
Commented:
java.exe is Sun's JVM.  If you want to use Microsoft's JVM (I'm assuming that is your question) you must run JVIEW.EXE.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.