import - How do I check out an SVN project into Eclipse as a Java project?





add from (8)


You can do it directrly from Eclipse if you install Subclipse or Subversive plugin. Then you can either reimpoort your project into workspace or use Team -> Share option in context menu (right-click) of the project.

I was trying to check out a project from SVN using Eclipse. I tried using "Checkout As" to make it into a "Java project from existing Ant script", but the project wizard requires the file to have already been downloaded. Is there a way to checkout the project into Eclipse as a Java project, without having to download it elsewhere first?

(I am using Eclipse Ganymade 3.4.1 with Subversive.)







Make sure you have the svn plugin installed see here - http://www.eclipse.org/subversive/downloads.php

  • From Eclipse's File menu, choose Import to display the import manager.
  • Choose Checkout Projects from SVN
  • Create a new location
  • Enter your repository url
  • Hit finish



How to Open an Existing SVN Project in Eclipse

Note

  • You'll find the commands for SVN under the Team sub-menu when you right click on your project.

  • I've had trouble in the past when connecting to SVN repositories using the svn+ssh:// protocol - a quick fix is to change the SVN interface (under Window > Preferences > Team > SVN) to the pure Java option (SVNKit IIRC).







If it wasn't checked in as a Java Project, you can add the java nature as shown here.




Can anyone tell me how to download the project

It's a SVN repository. SVN is a version control system (Software used to track changes to your code etc) . You have to check out the repository using an SVN client of some sort.

check this tutorial out for using an SVN client. http://www.themememe.com/subversion-for-absolute-beginners

Since you dont want to contribute any changes back to the project, you can use simply look up the importing part. But I recommend you learn more about SVN and other version control systems such as GIT. They will really help you in any kind of software engineering.




Let us take an example.

Suppose I wish to generate a number between 5-10:

int max = 10;
int min = 5;
int diff = max - min;
Random rn = new Random();
int i = rn.nextInt(diff + 1);
i += min;
System.out.print("The Random Number is " + i);

Let us understand this...

Initialize max with highest value and min with the lowest value.

Now, we need to determine how many possible values can be obtained. For this example, it would be:

5, 6, 7, 8, 9, 10

So, count of this would be max - min + 1.

i.e. 10 - 5 + 1 = 6

The random number will generate a number between 0-5.

i.e. 0, 1, 2, 3, 4, 5

Adding the min value to the random number would produce:

5, 6, 7, 8, 9, 10

Hence we obtain the desired range.