aspose file tools*
The moose likes Linux / UNIX and the fly likes path classpath issue after installing Java on Mandrake10 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "path classpath issue after installing Java on Mandrake10" Watch "path classpath issue after installing Java on Mandrake10" New topic
Author

path classpath issue after installing Java on Mandrake10

david lightman
Ranch Hand

Joined: Nov 03, 2004
Posts: 82
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...
-then./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

Joined: Jun 25, 2001
Posts: 16228
    
  21

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: path classpath issue after installing Java on Mandrake10