Results 1 to 2 of 2
  1. #1
    johnmerlino is offline Member
    Join Date
    May 2014
    Posts
    56
    Rep Power
    0

    Default managing class paths on different operating systems

    I use git as my SCM and I use both Ubuntu and Mac OSX. The home directory of the two operating systems are different and there lies the problem. When I commit the .classpath to version control, it looks something like this:

    Java Code:
     <classpath>
     	<classpathentry kind="src" path="src"/>
     	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
     	<classpathentry kind="lib" path="/Users/MyUser/Documents/github/Gateway/GDGateway/java-json.jar"/>
     	<classpathentry kind="lib" path="/Users/MyUser/Documents/github/Gateway/GDGateway/postgresql-9.3-1101.jdbc41.jar"/>
     	<classpathentry kind="output" path="bin"/>
     </classpath>

    Now when I update my project on Ubuntu. I have to change the build path again because it is referencing paths on OSX. And this goes back and forth. Rather than remove this file from git with .gitignore, I'd prefer to use a global environment variable like as follows:

    Java Code:
     <classpath>
     	<classpathentry kind="src" path="src"/>
     	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
     	<classpathentry kind="lib" path="$HOME/Documents/github/Gateway/GDGateway/java-json.jar"/>
     	<classpathentry kind="lib" path="$HOME/Documents/github/Gateway/GDGateway/postgresql-9.3-1101.jdbc41.jar"/>
     	<classpathentry kind="output" path="bin"/>
     </classpath>
    Is this possible?

  2. #2
    kneitzel is offline Senior Member
    Join Date
    Feb 2014
    Posts
    447
    Rep Power
    1

    Default Re: managing class paths on different operating systems

    Hi,

    when you add external jars in eclipse, then the absolute path is inserted inside the .classpath file. You have it inside source control and inside your Workspace, so you could simply "Add Jars". Then you get a relative entry which would solve these issues.

    The solution with environment variable mght solve the issue for now but as soon as you try to use the project somewhere else you will run into the same trouble again!

    With kind regards,

    Konrad

    Edit: This add jars is Project Properties, Java Build Path, Libraries but you should know that page already because you have add jars and add external jars there.
    Last edited by kneitzel; 06-05-2014 at 07:56 AM.

Similar Threads

  1. Body Systems Class
    By loux2015 in forum New To Java
    Replies: 3
    Last Post: 09-17-2013, 07:04 PM
  2. [SOLVED] Class paths and Packages issue
    By kammce in forum New To Java
    Replies: 14
    Last Post: 07-12-2012, 06:10 AM
  3. How to find operating system of LAN systems..?
    By ram07 in forum Networking
    Replies: 2
    Last Post: 03-31-2011, 04:19 AM
  4. Replies: 0
    Last Post: 05-31-2009, 08:11 AM
  5. Tracking Operating System
    By Mansi in forum Networking
    Replies: 2
    Last Post: 07-23-2007, 02:41 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •