• Post Reply Bookmark Topic Watch Topic
  • New Topic

path classpath issue after installing Java on Mandrake10  RSS feed

david lightman
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am struggling to get my java set up to write, compile and run some java programs, and honestly being a linux newbie the docs for such are somewhat confusing..

I am trying to break this down as simple as possible.

-I am logged into Linux as root.
-then download the j2sdk1.4.2_06 in the /USR/ dir
-I did chmod +x j2sdk1.4.2_06...
it installed successfully.
now I have a new dir called /usr/j2sdk1.4.2_06
but setting up the path classpath is different.
I would like two things:

I would like to create a directory called javasrc to hold all my java source code
but I do not want to develop in with root account, I want any user to be able to use the javasrc directory and be able to compile and run the programs..

what exactly do I edit. someone said I need to edit a file in /ETC/PROFILE
[ December 27, 2004: Message edited by: david lightman ]
Tim Holloway
Saloon Keeper
Posts: 18800
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, you want a common source directory. Actually, it's probably more common these days to keep the code in an archive such as CVS and have the developers grab their own private copies to work with, then commit the changes back to the archive once they're ready for use. But we'll go with your plan.

The key here is to use the Unix groups feature. Every user belongs to at least one group. In many Linuxes, a unique group is created for each user. However you can also create common groups that contain multiple users. So for example, create the group named "developers". If you have a GUI user manager, use that, otherwise the command (I think) is grpadd.

Now add users to that group. Once again, a GUI user manager helps, but the command-line version is named something like usrmod or moduser.

Now create your project source directory. Let's say you'll make that be /home/projects/src. Create that directory and chattr its group to "developers" and grant rights of 775 (Owner and group can read/write, strangers can read). The "x" bit is required in order to access the files in that directory, so it's not 664, like it would be for files. You can also play with other things like the "sticky" bit if they help make things work more like you want.

OK, so you have a source directory. In order to use Java, you need a Java in your path. Since many users will want it, probably /etc/profile is the file to edit. Simply add a "PATH=/usr/j2sdk1.4.2_06:$PATH" to /etc/profile, and make sure that there's also an "export PATH" line somewhere after it so that the addition of the JDK will be exported to the user signon process. Once you do that, just sign on as a developer and type "java -v" and the java program should run and display its version number.
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!