Changeset 15133 for release-kits/shared/search4j
- Timestamp:
- 2008-03-26T15:30:33+13:00 (16 years ago)
- Location:
- release-kits/shared/search4j
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
release-kits/shared/search4j/search4j.cpp
r15103 r15133 31 31 bool verbose = false; 32 32 bool use_minimum = false; 33 string hint = ""; 33 34 34 35 enum JvmProperty { … … 257 258 << "find: find java and print out information about it" << endl 258 259 << endl 259 << " search4j [-v|-e] [-m VERSION_STRING]" << endl260 << " eg: search4j - m 1.4.1_01 -e" << endl260 << " search4j [-v|-e]" << endl 261 << " eg: search4j -e" << endl 261 262 << endl 262 263 << " by default, print JAVA_HOME. E.g., C:\\Program Files\\jre1.5.0_15, or" << endl 263 264 << " if -v is specified, print the java version string. E.g. 1.5.0_15, or" << endl 264 265 << " if -e is specified, print the path the to the java executable. E.g. C:\\Program Files\\jre1.5.0_15\\bin\\java.exe" << endl 265 << " if -m option is used, find a java of the given version or newer, or fail" << endl266 266 << endl 267 267 << "compare: compare the found java with the given java version string" << endl … … 280 280 << endl 281 281 << " specify the location of the jar relative to the current directory" << endl 282 << " if -m option is used, find a java of the given version or newer" << endl283 282 << endl 284 283 << "Global Options:" << endl 284 << " -m VERSION_STRING: (minimum) find a java of the given version or newer, or fail" << endl 285 << " -h LOCATION: (hint) as a last resort look for java in LOCATION (treated as a JAVA_HOME)" << endl 285 286 << " --verbose : have search4j print out information about what its doing" << endl 286 287 << " --help : display this usage screen" << endl … … 330 331 javaHome = getenv( "JAVA_HOME" ); 331 332 if ( javaHome != NULL ) { 332 if ( verbose ) cout << "(" << javaHome << ") ";333 if ( verbose ) cout << "(" << javaHome << ") "; 333 334 jvm.setJavaHome( javaHome ); 334 335 if ( jvm.check() ) { … … 350 351 javaHome = getenv( "JRE_HOME" ); 351 352 if ( javaHome != NULL ) { 352 if ( verbose ) cout << "(" << javaHome << ") ";353 if ( verbose ) cout << "(" << javaHome << ") "; 353 354 jvm.setJavaHome( javaHome ); 354 355 if ( jvm.check() ) { … … 423 424 #endif 424 425 426 if ( !jvmFound ) { 427 //try the hint 428 if ( verbose ) cout << " - trying hint: "; 429 if ( strcmp(hint.c_str(),"") != 0 ) { 430 if ( verbose ) cout << "(" << hint << ") "; 431 jvm.setJavaHome( hint ); 432 if ( jvm.check() ) { 433 if ( use_minimum ) { 434 if ( jvm.compare( minimum ) >= 0 ) { 435 jvmFound = true; 436 } 437 } else { 438 jvmFound = true; 439 } 440 } 441 } 442 if ( verbose ) { if( jvmFound ) cout << "yes" << endl; else cout << "no" << endl; } 443 } 444 445 425 446 return jvmFound; 426 447 } … … 453 474 if ( i == argc-1 ) { 454 475 usage(); 455 return 0;476 return -1; 456 477 } else { 457 478 arg1 = argv[++i]; 458 479 } 459 480 460 481 } else if ( strcmp(argv[i], "-m") == 0 ) { 461 482 if ( i == argc-1 ) { 462 483 usage(); 463 return 0;484 return -1; 464 485 } else { 465 486 if ( !minimum.setVersionFromString( argv[++i] ) ) { … … 471 492 472 493 } else if ( strcmp(argv[i], "-l") == 0 ) { 473 action = Launch; 474 arg1 = argv[++i]; 494 if ( i == argc-1 ) { 495 usage(); 496 return -1; 497 } else { 498 action = Launch; 499 arg1 = argv[++i]; 500 } 501 502 } else if ( strcmp(argv[i], "-h") == 0 ) { 503 if ( i == argc-1 ) { 504 usage(); 505 return -1; 506 } else { 507 hint = argv[++i]; 508 } 475 509 476 510 } else {
Note:
See TracChangeset
for help on using the changeset viewer.