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
ab2aeAsked:
Who is Participating?
 
colr__Connect With a Mentor Commented:
ok, is V19may.jar in the same directory as your batch file?

If not, Ive seen this message before when running an application on an oldere JVM thatn what the application was compiled to.
To test this, run the batch file via dos - you should get a better error repport doing it that way.

colr__
0
 
objectsConnect With a Mentor Commented:
you need to set your CLASSPATH environment variable to specify the location of your class files

http://mindprod.com/jgloss/classpath.html

"For NT/W2K/XP/W2K3, since there is no autoexec.bat, you have to preload the environment strings into the environment with Settings ? control panel ? system ? environment. You can use traditional BAT files to create them, then echo, copy and paste them into the permanent environment. Remember to click set before you click OK or your new settings will be discarded. Also see the rules above for dealing with directory of jar filenames containing blanks Alternatively always install your apps in directories without embedded spaces. Make sure you have no lead or trail spaces on the classpath as a whole. The control panel uses a microscopic unreadable font. To proofread, copy/paste to an editor. Beware of spurious spaces introduced by copy/pasting."
0
 
colr__Commented:
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__
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

 
ab2aeAuthor Commented:
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??!!
0
 
colr__Commented:
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__
0
 
borbjoCommented:
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 ;-)
0
 
ab2aeAuthor Commented:
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 :(
0
 
colr__Commented:
Can you tell us the package statment your using? As well as the location and name of your main() class.

colr__
0
 
ab2aeAuthor Commented:
package statement?
0
 
ab2aeAuthor Commented:
I have changed the environment variables
PATH: C:\j2sdk1.4.0_01\bin
CLASSPATH: "C:\Documents and Settings\Barry\Desktop\Virtura"

still same error
0
 
colr__Commented:
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__
0
 
ab2aeAuthor Commented:
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
0
 
Mayank SAssociate Director - Product EngineeringCommented:
Its against the site rules to post e-mail IDs on question-pages. Post the contents of the batch file here.
0
 
ab2aeAuthor Commented:
ive seen someone post an email address before!

Contents of batch file: java -cp V19may.jar Screen
0
 
Mayank SConnect With a Mentor Associate Director - Product EngineeringCommented:
>> ive seen someone post an email address before!

The moderators delete it when they see it.

>> java -cp V19may.jar Screen

Yes, colr is right - you need V19may.jar in the same directory that contains the Screen.class file (I assume this is where you are running from), otherwise specify the full-path of the JAR file.
0
 
ab2aeAuthor Commented:
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?
0
 
Mayank SAssociate Director - Product EngineeringCommented:
If there is no such jar which is needed, just try:

java Screen

- do it from the directory that contains the Screen.class file.
0
 
ab2aeAuthor Commented:
"- do it from the directory that contains the Screen.class file."

u mean change the contents of the .bat file?
0
 
Mayank SAssociate Director - Product EngineeringCommented:
Yes, because if the JAR is not required, then its a wrong command in the batch file.
0
 
ab2aeAuthor Commented:
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
0
 
Mayank SAssociate Director - Product EngineeringCommented:
Could you tell us if the directory "C:\Documents and Settings\Desktop\Virtura" (from which you are running this batch-file) contains class-file?
0
 
ab2aeAuthor Commented:
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 ;)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.