The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
call constructor of java class in script thebladerunner Shell Programming and Scripting 1 10-21-2008 03:23 PM
How to call Java by using shell script aaabbb123123 Shell Programming and Scripting 2 08-21-2008 02:02 AM
How to call Java class from ksh jyotib Shell Programming and Scripting 3 01-14-2008 02:40 PM
how to use classes in c ?!?!? atticus High Level Programming 4 05-19-2007 10:06 PM
file transfer Methods Teh Tiack Ein Shell Programming and Scripting 2 07-07-2005 02:08 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-23-2006
girish.sh girish.sh is offline
Registered User
  
 

Join Date: Jun 2006
Posts: 10
How to call Java classes/methods from ksh

Hi all, i am new to shell scripts and have one doubt.

Can we call ava classes/methods from shell scripts? if yes how?
  #2 (permalink)  
Old 06-23-2006
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,796
Yes you can call java classes.

Code:
#! /bin/ksh

export CLASSPATH=/dir/containing/the/class:$CLASSPATH

/path/to/java HelloWorld
  #3 (permalink)  
Old 06-23-2006
girish.sh girish.sh is offline
Registered User
  
 

Join Date: Jun 2006
Posts: 10
Vino,

Thanks for your reply but can u explain the CLASSPATH part of it??

Thanks,
Girish
  #4 (permalink)  
Old 06-23-2006
girish.sh girish.sh is offline
Registered User
  
 

Join Date: Jun 2006
Posts: 10
Also, how to call the methods of the class??
  #5 (permalink)  
Old 06-23-2006
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,796
Quote:
Originally Posted by girish.sh
Vino,

Thanks for your reply but can u explain the CLASSPATH part of it??

Thanks,
Girish
Lets say your classfile HelloWorld is in the directory ~/java/samples/class. Then you need to either
- add that path to the classpath setting
- or add a . to the classpath.
  #6 (permalink)  
Old 06-23-2006
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,796
Quote:
Originally Posted by girish.sh
Also, how to call the methods of the class??
Calling methods is the class's responsibility. It depends on how you have coded your class.
  #7 (permalink)  
Old 06-23-2006
girish.sh girish.sh is offline
Registered User
  
 

Join Date: Jun 2006
Posts: 10
Yes but from shell script, we call class like path/to/java classname

so if i want to call method classMethod, call will be like this?

"path/to/java classname.classMethod()"
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:54 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0