Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unable to Change Classpath

 
Somnath Mallick
Ranch Hand
Posts: 483
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Everyone,

I am trying to change classpath in a Sun Solaris from 1.4 to 1.6. But when I run the command:

I get the error:

Am i doing it correctly?
 
Rob Spoor
Sheriff
Pie
Posts: 20546
57
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try using this: No spaces around the =, I believe bash doesn't like them.

See also http://faq.javaranch.com/java/HowToSetTheClasspath
 
Somnath Mallick
Ranch Hand
Posts: 483
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I ran the command and its taking it in properly, but when i run the command

I still get this:

And I am trying to execute a jar which throws the mojor.minor exception.
 
Rob Spoor
Sheriff
Pie
Posts: 20546
57
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's because you are mixing the CLASSPATH and PATH variables. You should change the PATH variable: Don't forget that trailing :$PATH or your path will no longer have /bin, /usr/bin etc in it.

Note that you should put the new JDK path before $PATH because the shell will look from start to end in the path. If you put it at the end the old java will be found.

Note 2: you can find out which java command is being executed by calling "which java".
 
Somnath Mallick
Ranch Hand
Posts: 483
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the help! But still not happening! I have attached the screenshot of what i am doing! Please take a look...
ScreenShot.JPG
[Thumbnail for ScreenShot.JPG]
Solaris Screen Shot.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49382
62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please don't attach a screenshot; it is difficult to read. Use ctrl-shift-C to copy from the terminal.

Why are you trying to set a CLASSPATH in the first place? Setting a system CLASSPATH is almost always a mistake.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49382
62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your PATH entry should end with /bin or /bin/
 
Somnath Mallick
Ranch Hand
Posts: 483
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Cambell and Rob! Adding the /bin helped and my code is working now!
 
Campbell Ritchie
Sheriff
Pie
Posts: 49382
62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome. And delete the classpath, which you ought not to use.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic