Link to home
Start Free TrialLog in
Avatar of ab2ae
ab2ae

asked on

How to correctly install Java 1.4.0_01

I have downloaded this java sdk: 1.4.0_01

However, when i try to run a .bat file that i have, it wont work, saying, "NoClassDefFoundError"

I am pretty sure i have to alter something in the autoexec.bat, which i have no idea where this is

I did have this 1.4.0_01 sdk working on my machine before, and i remember having to do something with the environment variable, but cant remember. I am using windows XP Pro

Any help as im sure this is not hard to solve
SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia 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 colr__
colr__

You can also set the classpath in your batch file, like the following:

java -classpath "C:/mySoftware/root" TheProgram

I tend to use batch files a lot for this kind of thing to, and I personally find that setting the classpath in the batch file is easier than setting it in Windows itself.

colr__
Avatar of ab2ae

ASKER

To make things easier (hopefully) here are some details

My path is: C:\Documents and Settings\Desktop\Virtura

The .bat file is called: V19may

Objects your post confused me and colr i have no idea where and how to set the classpath in my batch file??!!
The batch file is just a text file with DOS code in it - open this up in Notepad and youll see somewhere a line saying java <yourapplicationname>

So, with your path above, youd want to use this instead:

java -classpath "C:\Documents and Settings\Desktop\Virtura" <yourapplicationname>

colr__
before you run your bat file, run this in DOS:

SET CLASSPATH=%CLASSPATH%;.;

The "." means that you add the current directory to your classpath. That's what the problem is here - you should always have the current directory in your classpath - thus you should always have . in your classpath ;-)
Avatar of ab2ae

ASKER

I went to the command prompt screen typed in SET CLASSPATH=%CLASSPATH%;.; then right-clicked on the .bat file and went to 'Edit'

Changed the path as follows: java -cp "C:\Documents and Settings\Desktop\Virtura" V19may.jar Screen

Still get the SAME error "NoClassDefFoundError"

This is a real pain to put it mildly :(
Can you tell us the package statment your using? As well as the location and name of your main() class.

colr__
Avatar of ab2ae

ASKER

package statement?
Avatar of ab2ae

ASKER

I have changed the environment variables
PATH: C:\j2sdk1.4.0_01\bin
CLASSPATH: "C:\Documents and Settings\Barry\Desktop\Virtura"

still same error
How many classes are in your application?
If more than one, are the all in the same folder?

Looking back at your first post -what exactly is your batch file supposed to be doing? I think we've been assuming its to run a java application, but Im now starting to wonder...

colr__
Avatar of ab2ae

ASKER

there are many classes, its an app i downloaded from a lecturer so i know it works as ive used it before. All i need to do is double-click the .bat file and it should run

The batch file is supposed to open up a class which serves as the main interface, as i said, i never wrote it

do u have an email address, i will send u the whole foler, it is DEFINATELY java
Its against the site rules to post e-mail IDs on question-pages. Post the contents of the batch file here.
Avatar of ab2ae

ASKER

ive seen someone post an email address before!

Contents of batch file: java -cp V19may.jar Screen
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
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
Avatar of ab2ae

ASKER

v19may IS the name of the batch file, i dont have a jar file in the folder. But why would it work before and i didnt have to change ANYTHING?
If there is no such jar which is needed, just try:

java Screen

- do it from the directory that contains the Screen.class file.
Avatar of ab2ae

ASKER

"- do it from the directory that contains the Screen.class file."

u mean change the contents of the .bat file?
Yes, because if the JAR is not required, then its a wrong command in the batch file.
Avatar of ab2ae

ASKER

tried it same error "NoClassDefFoundError"

ive had enough for one day 4hrs of wasted time im steaming at the ears, will be speaking to my lecturer tomorrow then will post solution hopefully

ARGH
Could you tell us if the directory "C:\Documents and Settings\Desktop\Virtura" (from which you are running this batch-file) contains class-file?
Avatar of ab2ae

ASKER

OK guys, all i had to do was put the zipped version called 'version19may.jar' into the folder which contained the bat file.

Silly silly silly me, thansk for your help it was very good i learnt alot from this ;)