This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unable to Change Classpath

 
Somnath Mallick
Ranch Hand
Posts: 482
  • 0
  • 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: 20381
46
Chrome Eclipse IDE Java Windows
  • 0
  • 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: 482
  • 0
  • 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: 20381
46
Chrome Eclipse IDE Java Windows
  • 0
  • 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: 482
  • 0
  • 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
Solaris Screen Shot.
[Thumbnail for ScreenShot.JPG]
 
Campbell Ritchie
Sheriff
Pie
Posts: 47288
52
  • 0
  • 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: 47288
52
  • 0
  • 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: 482
  • 0
  • 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: 47288
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome. And delete the classpath, which you ought not to use.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic