Link to home
Start Free TrialLog in
Avatar of Rodger Reedy
Rodger ReedyFlag for United States of America

asked on

Running .jar file with Java Runtime 5.0

With Java Runtime 5.0 installed, a .jar file will not run.
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

How are you trying to run it?
assuming its an executable jar use:

java -jar xyz.jar

If its not you need more details to be able to run it

Does it include the manifest file?

If not, you must run like this:

java -cp xyz.jar mypackage.MyMainClass
SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Rodger Reedy

ASKER

The same version of Java and the .jar file have intalled and run successfully on other workstations, but will not on this one.
What do you get from command

java -version

at the command line?
Which operating system are you running?

I suspect the Java installation is gone wrong. You could reinstall it.
Avatar of coolguy_iiit
coolguy_iiit

Can you post what error you are getting when trying to run?
I have J2se Runtime Environment 5.0 Update 6 (Version 1.5.0, build 1.5.0.06-b05.

I don't get an error message.  When I double click the jar file, the DOS window briefly flashes, but nothing else happens.
I also uninstalled and reinstalled the Java - same result

I installed the same files on a laptop and it all worked OK.  Must be some configuration setting on this computer.
>>When I double click the jar file ...

Don't do that - you won't see the errors. Run it from the command line
The error is :  Exception in thread "main" java.lang.NoClassDefFoundError.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
>>The problem is there is no JAVA_HOME environment variable set.

Most unlikely, though it *should* be set - you can do that later

Can you actually paste the full error into this question please?
Full error message:

Exception in thread "main" java.lang.NoClassDefFoundError: F:\IRAD\WR cd folder\smartTag-install.jar

That's all there is to the error message.
I must say that doesn't much look like an app.

You need to run that thus, after having changed to the directory in which the jar is:

java -jar smartTag-install.jar

(if it's an executable jar)

or

java -classpath smartTag-install.jar <The fully-qualified class name here>

if it isn't


What CEHJ said is correct...

Hope you understood the concept also
While I believe your solution is correct, the immediate need to resolve it has past and I will work it later.  I accept the solution.
OK
The need for this solution went away.  Did not try to completely implement.

Thanks for all the input.