Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Correct classpath syntax for SuSe Linux  RSS feed

 
Donald Nunn
Ranch Hand
Posts: 200
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, all. Is anyone familiar with the correct syntax for classpaths, paths, etc.. using SuSe linux? Also, would anyone know of a good source for this level of information.
Thanks,
 
Tim Holloway
Saloon Keeper
Posts: 18795
74
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Same as for other Linux/Unix systems. The differences are in pathname format (slashes, not backslashes, just like all other *nix pathnames) and use of the ":" (colon) as a pathname separator instead of the ";" (semicolon). Set the environment variable as follows:
CLASSPATH=/usr/local/javajars/mydbc.jar:/usr/local/javaclasses:.
export CLASSPATH
(varies slightly depending on which shell you're using). You can and often will put this in your login script.
Note that in the example, the last path was ".", meaning look in the current directory. Which you may or may not want to do, but If you don't, the current directory won't be used.
For java command purposes, you can also do:
javac -classpath /usr/local/moreclasses:/usr/local/javajars/neatstuff.jar MyClass.java
I'd have to doublecheck, but I think that that completely overrides the CLASSPATH environment, so to get a cumulative classpath, you'd have to do:
javac -classpath $CLASSPATH:/usr/local/moreclasses:/usr/local/javajars/neatstuff.jar MyClass.java
[ May 14, 2002: Message edited by: Tim Holloway ]
 
Donald Nunn
Ranch Hand
Posts: 200
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, Tim. That's what I'm looking for. You mentioned login scripts. Where could I locate some examples on coding login scripts. Also, I've installed Tomcat and it's working great, however, I would like to devise a way to launch it from my desktop instead of using startup.sh.
Thanks,
 
Tim Holloway
Saloon Keeper
Posts: 18795
74
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
login scripts are just collections of commands in a file. If you're using the bash shell, it should be be ~/.bash_profile. Once again, depending on the distro and command shell you're using, things will vary slightly. Intro Linux books usually have some info on scripting.
I prefer to run Tomcat as a system service myself - the RPM distro creates all the requisite files so all I have to say is "/sbin/service Tomcatx start" (or stop, or restart). A desktop launch would just be a shell script places attached to an icon, and the exact process will vary on what you like to use for a desktop. Clicking the right mouse button on the desktop generally will popup a menu that will assist you.
 
Donald Nunn
Ranch Hand
Posts: 200
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Great explanation, Tim and thanks. I'm a newbie with Linux and I'm attempting learn as much as I can. Having a hard time finding current books on the Suse distribution, although the manuals are not half bad. Anyway, thanks a again.
Regards,
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear in mind that most Linux distributions are much more similar to each other than they are different. General Linux books are useful whichever distribution you use, so don't worry that you need SuSE-specific books.
I like "Linux in a Nutshell" from O'Reilly as a very handy reference, and I have used it successfully with many different distributions, including SuSE.
 
Carl Parrish
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may also want to check out rute.sourceforge.net. Its available both as a internet book and you buy it at amazon.
And if you're going to have several java users using your box and don't want to have to reset the classpath for each user you may want to add it to your /etc/profile script instead.
Carl Parrish
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!