File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Can't run simple class with 1.4 method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Can Watch "Can New topic

Can't run simple class with 1.4 method

Mike Ottinger
Ranch Hand

Joined: Jan 11, 2002
Posts: 125
Hi Folks,

I work with a product that requires jdk 1.3. Yet I also need to use jdk 1.4 for other work. I've had jdk 1.3 installed and working fine. I downloaded the 1.4 jdk from sun and installed it. I created a simple hello world app that uses a String split() method in it to confirm that 1.4 is working. I'm able to compile the class ok, but when I run it I get a NoSuchMethodError on the line calling split(). I've set my classpath to have the jdk1.4 before my 1.3 jdk and after. I've taken the 1.3 jdk line out altogether, but nothing seems to work. Any ideas would be greatly appreciated, thanks.

SCJP 1.4 SCJD 1.5
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42959
Setting the classpath is not the whole story. If the "java" executable you run is the one from 1.3, it will use the 1.3 libraries no matter what. Make sure that your "path" is set so that you run the 1.3 binaries.
Mike Ottinger
Ranch Hand

Joined: Jan 11, 2002
Posts: 125
Thanks for the reply, yep, I switched the path to my 1.4 exe's to the very front of my path and it worked. Thanks for the help, I was always under the impression PATH settings were only for compiling.

- M
Stuart Ash
Ranch Hand

Joined: Oct 07, 2005
Posts: 637
Use Eclipse for your work, and set the compliance level to 1.3 or 1.4 or 5 according the the requiremetns of each of your projects.

That will take care of the differences.

ASCII silly question, Get a silly ANSI.
I agree. Here's the link:
subject: Can't run simple class with 1.4 method
It's not a secret anymore!