IJava Fumana isiKhombisi esiSebenzayo ngoku

Ungasifumana njani isikhombisi esisebenzayo ngoku kwiJava? Isikhokelo esisebenzayo ngoku sithetha ulawulo lweengcambu zeprojekthi yangoku yeJava.

Singafumana isikhombisi esisebenzayo ngoku kwiJava sisebenzisa inkqubo elandelayo yokusebenza kwepropathi:

String cwd = System.getProperty('user.dir');

Fumana isikhombisi esisebenzayo ngoku kwiJava Umzekelo

public class CurrentWorkingDirectory {
public static void main (String args[]) {

String cwd = System.getProperty('user.dir');
System.out.println('Current working directory : ' + cwd);
} }

Iziphumo:


Current working directory: C:workspaceJava4Testers

Idibeneyo: