Unix Shell script vs Java


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Unix Shell script vs Java
# 8  
Old 08-11-2007
Again this depends what your database interactions are.

If you have standard static queries, then it is possible that scripts will be fine. If on the other hand you want to apply business logic and create dynamic queries, then it is probable that java(or another high level language) will be more flexible and maintainable, the exception being that you could also do this in perl if this qualifies as a scripting language.
# 9  
Old 08-11-2007
no reborg...thanks for that output....but we can't use perl...does unix bash support exception handling?
and mainly static database interactions......
# 10  
Old 08-11-2007
Quote:
Originally Posted by navojit dutta
but does unix have exception handling that java does with ease.....?
I think you mean "does shell scripting have exception handling".

UNIX is really the operating system. You are comparing shell scripting with Java programming, not unix programming.

To me, traditional UNIX programming means Kernighan and Ritchie C.
# 11  
Old 08-11-2007
am bit confused with your blog....its like the OS is Unix deffinitely.....but do unix shell script be able to take up exception handling with number of file operations....we are not in a scope to use C and unix API's....purely shell script or java....whichever make the work done....am trying to back unix shell script but it being a scripting language will it be able to take up the complicasies easily.....what do u think that shell script can do and Java can't....?
# 12  
Old 08-11-2007
Quote:
Originally Posted by navojit dutta
what do u think that shell script can do and Java can't....?
Tweaked on the fly without recompiling. Smilie
# 13  
Old 08-11-2007
First off, please punctuate your posts correctly. They are difficult to read with the inappropriate use of elipsis.

Work on a system where java is not installed Smilie

Seriously though, we cannot advise you if we don't know what your workload characteristic and business logic are. I don't mean to be rude here, but I would say that if you are not in a position to answer these questions yourself then you are not in a position to argue that shell scripting is appropriate to your needs.
# 14  
Old 08-11-2007
So Java is a virtual machine. It has abstracted so much of the physical environment that allows it to reliably model most of the runtime errors as exceptions in a unified manner. You cannot expect an environment that lacks similar kinds of facilities to give you identical support. This is especially true of the Unix shell.

In a nutshell, generally speaking, if you have to do some Unix-specific operations, such as grepping and processing the output of "ps -aux", it's probably best to have all those processing in shell scripts. For more high-level programming with a more concrete sense of application logic, such as those involving DB access, you should likely use a more structured programming language such as C/C++/Java. Programs written in these languages are generally easier to debug when they grow large as there are ample support of tools for debugging in those environments, compared with the Unix shell.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Script Shell in java code

Hello, This is my script shell: echo Mon premier script echo Liste des fichiers : ls -la exit 0 This is my code java: public class test { public static void main(String args) { try { Process process = Runtime.getRuntime().exec("sh script1.sh"); } catch... (2 Replies)
Discussion started by: chercheur857
2 Replies

2. Shell Programming and Scripting

how to execute a unix shell script from a java program

Hi All, well , i am facing this problem.. i have tried a few sample codes but there isn't any solution . could anyone please give a sample code as of how to do this... Please see the below details...and read the details carefully. I have written some code, logic is 1)from... (4 Replies)
Discussion started by: aish11
4 Replies

3. Shell Programming and Scripting

Calling Java Method from UNIX using shell script

Hi All, I need to call a java method from a shell script. I know we can use the command java ClassName to call the main method in it. But I need to call another method that is there in the class and pass an email to it. Can I use java ClassName.MethodName(email) Any help will be... (4 Replies)
Discussion started by: RahulK
4 Replies

4. UNIX for Advanced & Expert Users

run shell script in java?

hi, how to run shell script in java? i have script a.sh which takes 1 argument as input and returns exit code integer. how to handle it in java. should i have to invoke process to execute it and then wait til it completes ? please explain with code thanks (1 Reply)
Discussion started by: crackthehit007
1 Replies

5. Shell Programming and Scripting

Running shell script from java

Hello All, Hope all is well. I was trying to scratch my head here with simple problem of running Shell script in Java. I tried to google and look through forums but was unable to understand how to solve it. Here is my simple Java class, which resides in different directory then my shell... (2 Replies)
Discussion started by: samshaw
2 Replies

6. UNIX for Dummies Questions & Answers

Java or C for creating a unix shell?

Hi, Great to find this forum! I'm a complete newbie to unix, and am having a hard time finding my way around. Firstly, I've been reading something about c shell programming being one tenth the size of c programming done on unix.....I couldn't figure what that meant, but there were two... (7 Replies)
Discussion started by: sdsd
7 Replies

7. Shell Programming and Scripting

How to call Java by using shell script

Hi All, I am new to shell script, just wanted you guy to help. How do i call a java program by using shell script, pls give some samle code for it, thank you ver much. (2 Replies)
Discussion started by: aaabbb123123
2 Replies

8. Shell Programming and Scripting

Opening a UNIX shell in Java

Hi, I need to simulate the machine's native shell (sh), for that I open up a UNIX shell in my Java program. My code works fine with windows shell ('cmd') but with unix ('sh') I failed to retrieve the machine's prompt. I believe that the issue is unix-related and that the process I launched has... (2 Replies)
Discussion started by: guyi
2 Replies

9. Programming

exit status running java classpath in unix shell

I have a java classpath running inside of a unix shell script. During my testing it will error with lines that show an example like this below. java.io.FileNotFoundException error at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.<init>(FileInputStream.java:129), ... (2 Replies)
Discussion started by: mmcds
2 Replies

10. Shell Programming and Scripting

Running Shell Script from Java

Hi How can I call a .sh (shell script) from a java procedure? Is this possible at all? Please tell me. Thanks. Asty (3 Replies)
Discussion started by: Asty
3 Replies
Login or Register to Ask a Question